moonstone/ Switch Item
Contains the declaration for the moonstone/SwitchItem.SwitchItem component.
import SwitchItem from '@enact/moonstone/SwitchItem';
Members
SwitchItemComponent
moonstone/SwitchItem.SwitchItem represents a Boolean state. It displays a descriptive text and has a switch that represents the on/off state.
By default, SwitchItem
maintains the state of its selected
property. Supply the
defaultSelected
property to control its initial value. If you wish to directly control updates
to the component, supply a value to selected
at creation time and update it in response to
onToggle
events.
import SwitchItem from '@enact/moonstone/SwitchItem';
SwitchItemBaseComponent
moonstone/SwitchItem.SwitchItemBase represents a Boolean state. It displays a descriptive text and has a switch that represents the on/off state.
import {SwitchItemBase} from '@enact/moonstone/SwitchItem';
Properties
- children
The string to be displayed as the main content of the switch item.
- disabled
When
true
, a disabled visual state is applied to the switch item.Default: false- inline
When true, inline styling is applied to the switch item.
Default: false- onToggle
The handler to run when the switch item is toggled.
- selected
When
true
, the dispalyed "switch" icon is set to the "on" position.- value
The value that will be sent to the
onToggle
handler.Default: ''