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

Element
igc-switch
Slots
default — The switch label.
CSS Parts
base — The base wrapper of the switch.
control — The switch input element.
thumb — The position indicator of the switch.
label — The switch label.

Inherited from: IgcCheckboxBaseComponent

The disabled state of the component.

disabled: boolean

Defined in src/internals/mixins/forms/types.ts:32

Inherited from: IgcCheckboxBaseComponent

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

invalid: boolean

Defined in src/internals/mixins/forms/types.ts:39

Inherited from: IgcCheckboxBaseComponent

The label position of the control.

labelPosition: ToggleLabelPosition = 'after'

Defined in src/components/checkbox/checkbox-base.ts:91

Inherited from: IgcCheckboxBaseComponent

The name of the control, submitted with the form data.

name: string

Defined in src/internals/mixins/forms/types.ts:45

Inherited from: IgcCheckboxBaseComponent

get checked(): any

Defined in src/components/checkbox/checkbox-base.ts:78

The checked state of the control.

set checked(value: boolean): void

Defined in src/components/checkbox/checkbox-base.ts:78

Parameters

  • value: boolean

Returns void

Inherited from: IgcCheckboxBaseComponent

get defaultChecked(): any

Defined in src/internals/mixins/forms/types.ts:139

The initial checked state of the component.

set defaultChecked(value: boolean): void

Defined in src/internals/mixins/forms/types.ts:139

Parameters

  • value: boolean

Returns void

Inherited from: IgcCheckboxBaseComponent

Returns the HTMLFormElement associated with this element.

get form(): HTMLFormElement | null

Defined in src/internals/mixins/forms/types.ts:48

Returns HTMLFormElement | null

Inherited from: IgcCheckboxBaseComponent

get required(): any

Defined in src/internals/mixins/forms/types.ts:151

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

set required(value: boolean): void

Defined in src/internals/mixins/forms/types.ts:151

Parameters

  • value: boolean

Returns void

Inherited from: IgcCheckboxBaseComponent

A string containing the validation message of this element.

get validationMessage(): string

Defined in src/internals/mixins/forms/types.ts:54

Returns string

Inherited from: IgcCheckboxBaseComponent

Returns a ValidityState object for the element.

get validity(): ValidityState

Defined in src/internals/mixins/forms/types.ts:51

Returns ValidityState

Inherited from: IgcCheckboxBaseComponent

get value(): any

Defined in src/components/checkbox/checkbox-base.ts:61

The value of the control.

set value(value: string): void

Defined in src/components/checkbox/checkbox-base.ts:61

Parameters

  • value: string

Returns void

Inherited from: IgcCheckboxBaseComponent

Returns true when the element is a candidate for constraint validation.

get willValidate(): boolean

Defined in src/internals/mixins/forms/types.ts:59

Returns boolean

Inherited from: IgcCheckboxBaseComponent

Removes focus from the control.

blur(): void

Defined in src/components/checkbox/checkbox-base.ts:106

Returns void

Inherited from: IgcCheckboxBaseComponent

Checks validity and emits invalid when the control is invalid.

checkValidity(): boolean

Defined in src/internals/mixins/forms/types.ts:114

Returns boolean

Inherited from: IgcCheckboxBaseComponent

Simulates a click on the control.

click(): void

Defined in src/components/checkbox/checkbox-base.ts:94

Returns void

Inherited from: IgcCheckboxBaseComponent

Sets focus on the control.

focus(options: FocusOptions): void

Defined in src/components/checkbox/checkbox-base.ts:100

Parameters

  • options: FocusOptions

Returns void

Inherited from: IgcCheckboxBaseComponent

Checks validity and shows the browser message when invalid.

reportValidity(): boolean

Defined in src/internals/mixins/forms/types.ts:117

Returns boolean

Inherited from: IgcCheckboxBaseComponent

Sets a custom message. Invalid while message is not empty.

setCustomValidity(message: string): void

Defined in src/internals/mixins/forms/types.ts:120

Parameters

  • message: string

Returns void