import { KbqToggleModule } from '@koobiq/components/toggle';

KbqToggleComponent

componentСкопировать ссылку на KbqToggleComponent

A switch for turning an option on or off.

To show a validation error, put its text in a kbq-error inside the toggle bound to a form control.

@Component({ selector: 'kbq-toggle', exportAs: 'kbqToggle' })
class KbqToggleComponent extends KbqColorDirective implements CanUpdateErrorState {
    readonly errorStateMatcher = input<ErrorStateMatcher>();
    readonly big = input<boolean>(false);
    readonly labelPosition = input<ToggleLabelPositionType>('right');
    readonly ariaLabel = input<string>('', { alias: 'aria-label' });
    readonly ariaLabelledby = input<string | null>(null, {
        alias: 'aria-labelledby'
    });
    id = input<string | undefined>();
    readonly name = input<string | null>(null);
    readonly value = input<string | undefined>();
    disabled = input<boolean | undefined>();
    checked = input<boolean | undefined>();
    indeterminate = model<boolean | undefined>();
    readonly loading = input<boolean>(false);
    clickAction = input<KbqToggleClickAction | undefined>();
    readonly color = input<T | null | undefined>();
    readonly change = output<KbqToggleChange>();
    readonly errorState: Signal<boolean>;
    readonly inputElement: Signal<ElementRef<HTMLInputElement>>;
    get inputId(): string;
    get colorClassName(): string;
    updateErrorState(): void;
    focus(): void;
    getAriaChecked(): KbqCheckedState;
    onChangeEvent(event: Event): void;
    /** @deprecated */
    onLabelTextChange(): void;
    onInputClick(event: MouseEvent): void;
    setDefaultColor(color: T): void;
}
errorStateMatcherinputСкопировать ссылку на errorStateMatcherErrorStateMatcher

An object used to control when the error state is shown.

indeterminatemodelСкопировать ссылку на indeterminateboolean | undefined

Whether the toggle is indeterminate. This is also known as "mixed" mode and can be used to represent a checkbox with three states, e.g. a checkbox that represents a nested list of checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately set to false.

loadinginputСкопировать ссылку на loadingboolean

Property for manually set loading state.

clickActioninputСкопировать ссылку на clickActionKbqToggleClickAction | undefined

Defines the behavior when a user clicks on the toggle.

colorinputСкопировать ссылку на colorT | null | undefined

Color of the component. A value set in code holds until the input changes, and the default color is used while both are unset or falsy.

errorStateСкопировать ссылку на errorStateSignal<boolean>

Whether the toggle is in an error state.

colorClassNameСкопировать ссылку на colorClassNamestring

current class name of color

updateErrorState()Скопировать ссылку на updateErrorState()void

Updates the error state based on the error state matcher.

onLabelTextChange()DeprecatedСкопировать ссылку на onLabelTextChange()void

Does nothing: the view reads nothing from the label, so a change of it needs no re-check.

Kept for back-compatibility. Will be removed in 22.0.0.

setDefaultColor()Скопировать ссылку на setDefaultColor()void

this color will be used as a default value. For example [color]="'' | false | undefined | null".

KbqToggleChange

classСкопировать ссылку на KbqToggleChange

Change event object emitted by KbqToggleComponent.

class KbqToggleChange {
    source: KbqToggleComponent;
    checked: boolean;
}
checkedСкопировать ссылку на checkedboolean

The new checked value of the toggle.

KbqToggleClickAction

typeСкопировать ссылку на KbqToggleClickAction

Toggle click action when user click on input element. Alias of KbqCheckableClickAction.

type KbqToggleClickAction = KbqCheckableClickAction;

ToggleLabelPositionType

typeСкопировать ссылку на ToggleLabelPositionType

Position of the label relative to the switch.

type ToggleLabelPositionType = 'left' | 'right';
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.