ui/ Pressable
Exports the ui/Pressable.Pressable Higher-order Component (HOC).
import Pressable from '@enact/ui/Pressable';Members
PressableHigher-Order Component❌
since 1.14.0. Will be replaced by ui/Touchable in 2.0.0
ui/Pressable.Pressable is a Higher-order Component that applies a 'Pressable' behavior to its wrapped component. Its default event and property can be configured when applied to a component.
By default, Pressable applies the pressed property on mouseDown and removes it on mouseUp.
import Pressable from '@enact/ui/Pressable';Configuration
- depress
Configures the event name that activates the Pressable
Default: 'onMouseDown'- leave
Configures the event name that deactivates the Pressable when onMouseLeave is triggered
Default: 'onMouseLeave'- release
Configures the event name that deactivates the Pressable
Default: 'onMouseUp'- prop
Configures the property that is passed to the wrapped component when pressed
Default: 'pressed'
Properties added to wrapped component
- defaultPropKey
Default pressed state applied at construction when the pressed prop is
undefinedornull.Default: false- disabled
Whether or not the component is in a disabled state.
Default: false- prop
Current pressed state. When set at construction, the component is considered "controlled" and will only update its internal pressed state when updated by new props. If
undefined, the component is "uncontrolled" andPressablewill manage the pressed state using callbacks defined by its configuration.