ui/ Toggle Item
Unstyled toggle item components and behaviors.
This is not intended to be used directly, but should be extended by a component that will customize this component's appearance by supplying an iconComponent prop.
import ToggleItem from '@enact/ui/ToggleItem';Members
ToggleItemComponent
An unstyled item with built-in support for toggling.
Example:
<ToggleItem icon="lock" iconPosition="before">Toggle Me</ToggleItem>import ToggleItem from '@enact/ui/ToggleItem';ToggleItemBaseComponent
A minimally styled toggle item without any behavior, ripe for extension.
import {ToggleItemBase} from '@enact/ui/ToggleItem';Properties
The main content of the toggle item.
The type of component to use to render as root element.
This receives the
cssprop for theme extension and therefore must be a custom component and not a simple HTML DOM node. Recommended component or themed derivative: SlotItemThe
Iconto render in this item.This component receives the
selectedprop and value, and must therefore respond to it in some way. It is recommended to use ToggleIcon for this.Called with a reference to the root component.
When using ui/ToggleItem.ToggleItem, the
refprop is forwarded to this component ascomponentRef.Customizes the component by mapping the supplied collection of CSS class names to the corresponding internal elements and states of this component.
The following classes are supported:
toggleItem- The root class name
Applies a disabled visual state to the toggle item.
Default: falseAn optional prop that lets you override the icon of the
iconComponentcomponent.This accepts any string that the Icon component supports, provided the recommendations of
iconComponentare followed.Specifies on which side (
'before'or'after') ofchildrenthe icon appears.Default: 'before'An additional customizable icon component.
Supports more granular positioning rules. This should only be used after specifying the
iconproperty, as the positioning for this offers the ability to place this in front of or behind the existingicon. SeeitemIconPositionfor options.Specifies where
itemIconappears.'before'- first element in the item'beforeChildren'- beforechildren. IficonPositionis'before',iconwill be beforeitemIcon'afterChildren'- afterchildren. If iconPositionis'after',iconwill be afteritemIcon`'after'- the last element in the item
Default: 'afterChildren'Called when the toggle item is toggled. Developers should generally use
onToggleinstead.Called when the toggle item is toggled.
Applies the provided
icon.Default: falseThe value that will be sent to the
onTogglehandler.Default: null
ToggleItemDecoratorHigher-Order Component
Adds interactive functionality to ToggleItemBase.
import {ToggleItemDecorator} from '@enact/ui/ToggleItem';