ui/Toggleable

Exports the ui/Toggleable.Toggleable Higher-order Component (HOC).

import Toggleable from '@enact/ui/Toggleable';

Members

ToggleableHigher-Order Component

ui/Toggleable.Toggleable is a Higher-order Component that applies a 'Toggleable' behavior to its wrapped component. Its default event and property can be configured when applied to a component.

By default, Toggleable applies the active property on click events.

import Toggleable from '@enact/ui/Toggleable';
Configuration
activate
String

Configures the event name that activates the component.

Note: When using activate/deactivate instead of toggle, set toggle to null to prevent passing the default onToggle prop to the wrapped component.

deactivate
String

Configures the event name that deactivates the component.

Note: When using activate/deactivate instead of toggle, set toggle to null to prevent passing the default onToggle prop to the wrapped component.

toggle
String

Configures the event name that toggles the component.

Default: 'onToggle'
prop
String

Configures the property that is passed to the wrapped component when toggled.

Default: 'active'
Properties added to wrapped component
defaultPropKey
Boolean

Default toggled state applied at construction when the toggled prop is undefined or null.

Default: false
disabled
Boolean

Whether or not the component is in a disabled state.

prop
Boolean

Current toggled state. When set at construction, the component is considered "controlled" and will only update its internal value when updated by new props. If undefined, the component is "uncontrolled" and Toggleable will manage the toggled state using callbacks defined by its configuration.

toggle
Function

Event callback to notify that state should be toggled.

ArrayBooleanFunctionModuleNumberObjectString