Mixins / foldkit-mixins-ui

SwitchView

interface · packages/mixins-ui/src/switch/view.ts:17

interface SwitchView<Outer> {
  readonly id: string
  readonly checked: boolean
  readonly onToggle: (checked: boolean) => NoInfer<Outer>
  readonly label: string
  readonly description?: string | undefined
  readonly position?: TogglePosition | undefined
  readonly labelAside?: Html | undefined
  readonly disabled?: boolean | undefined
  readonly readOnly?: boolean | undefined
  readonly invalid?: boolean | undefined
  readonly name?: string | undefined
  readonly value?: string | undefined
  readonly style?: NamedStyle<typeof SwitchSlots> | undefined
  readonly mixins?: MixinList<Outer> | undefined
}

Members

SwitchView.id

property · packages/mixins-ui/src/switch/view.ts:19

readonly id: string

Prefixes the ids the switch draws, unique on the page.

SwitchView.checked

property · packages/mixins-ui/src/switch/view.ts:21

readonly checked: boolean

The application's field: on or off.

SwitchView.onToggle

property · packages/mixins-ui/src/switch/view.ts:23

readonly onToggle: (checked: boolean) => NoInfer<Outer>

Sent with the state a press leaves.

SwitchView.label

property · packages/mixins-ui/src/switch/view.ts:25

readonly label: string

The switch's accessible name, drawn beside it.

SwitchView.description

property · packages/mixins-ui/src/switch/view.ts:27

readonly description?: string | undefined

A line under the label, which also describes the control.

SwitchView.position

property · packages/mixins-ui/src/switch/view.ts:29

readonly position?: TogglePosition | undefined

end puts the words before the control. Default start.

SwitchView.labelAside

property · packages/mixins-ui/src/switch/view.ts:31

readonly labelAside?: Html | undefined

Drawn beside the label: a badge, a hint with a Tooltip.

SwitchView.disabled

property · packages/mixins-ui/src/switch/view.ts:32

readonly disabled?: boolean | undefined

SwitchView.readOnly

property · packages/mixins-ui/src/switch/view.ts:34

readonly readOnly?: boolean | undefined

Shows the state and refuses a press.

SwitchView.invalid

property · packages/mixins-ui/src/switch/view.ts:36

readonly invalid?: boolean | undefined

The track shows the error ring and says so to a screen reader.

SwitchView.name

property · packages/mixins-ui/src/switch/view.ts:38

readonly name?: string | undefined

Submitted under this name, as value while on and empty otherwise.

SwitchView.value

property · packages/mixins-ui/src/switch/view.ts:40

readonly value?: string | undefined

What an on switch submits. Default on.

SwitchView.style

property · packages/mixins-ui/src/switch/view.ts:41

readonly style?: NamedStyle<typeof SwitchSlots> | undefined

SwitchView.mixins

property · packages/mixins-ui/src/switch/view.ts:42

readonly mixins?: MixinList<Outer> | undefined