ui/ Changeable
Exports the ui/Changeable.Changeable Higher-order Component (HOC).
import Changeable from '@enact/ui/Changeable';
Members
ChangeableHigher-Order Component
ui/Changeable.Changeable is a Higher-order Component that applies a 'Changeable' behavior to its wrapped component. Its default event and value properties can be configured when applied to a component.
If the prop
is overridden, the property names to set the default value and current value change
correspondingly.
import Changeable from '@enact/ui/Changeable';
Configuration
- change
Configures the prop name to pass the callback to change the value
Default: 'onChange'- prop
Configures the prop name to pass the current value
Default: 'value'
Properties added to wrapped component
- change
Event callback to notify that the value has changed. The event object must contain a property with the same name as the configured
prop
.- defaultPropKey
Default value applied at construction when the value prop is
undefined
ornull
.- disabled
Controls whether the component is disabled.
Default: false- prop
Current value. 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" andChangeable
will manage the value using callbacks defined by its configuration.