Switch
Creates a toggleable switch.
Note that visual control of the switch is fairly limited compared to many other widgets -- you can't directly modify the width or height of the track or the thumb parts. Instead, configure your switch by passing in the relevant parameters.
Note that this widget is backed by a checkbox input. Use the ref
callback if you need access to it:
ref = ref { element -> element.getElementsByTagName("input")[0] as HTMLInputElement }
Parameters
Whether the switch is currently checked or not.
A callback which is invoked when the switch is toggled.
The modifier to apply to the container of this switch element. This will not be applied to the switch itself (since its configuration comes from the other parameters).
Whether the switch is enabled or not. If not, the switch will be rendered in a disabled state and will not be interactable.
The size of the switch. Defaults to SwitchSize.MD. You can implement your own SwitchSize if you want custom sizing.
A color palette which, if present, controls the colors for this switch. If not provided, the switch will use the relevant colors from the silk theming Palette.
An optional override for the color of the thumb.
An optional override for the border color when the input is focused.
Provides a reference to the container of the switch. Its direct children will be the underlying checkbox element and the switch track, whose direct child will be the thumb element.
Deprecated
Rename the `colorScheme` parameter to `colorPalette`. `ColorScheme` is a legacy name that is going away.