Class IgcSwitchComponent

Similar to a checkbox, a switch controls the state of a single setting on or off.

igc-switch

  • The switch label.

igcChange - Emitted when the control's checked state changes.

base - The base wrapper of the switch.

control - The switch input element.

thumb - The position indicator of the switch.

label - The switch label.

Hierarchy

Hierarchy

  • IgcCheckboxBaseComponent
    • IgcSwitchComponent

Properties

disabled: boolean

The disabled state of the component.

false
invalid: boolean

Sets the control into invalid state (visual state only).

false
labelPosition: ToggleLabelPosition = 'after'

The label position of the control.

label-position

name: string

The name attribute of the control.

Accessors

  • set required(value: boolean): void

    When set, makes the component a required field for validation.

    false
    

    Parameters

    • value: boolean

    Returns void

  • get validity(): ValidityState

    Returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.

    Returns ValidityState

  • get willValidate(): boolean

    A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.

    Returns boolean

Methods

  • Sets a custom validation message for the control. As long as message is not empty, the control is considered invalid.

    Parameters

    • message: string

    Returns void