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
String

Configures the event name that activates the Pressable

Default: 'onMouseDown'
leave
String

Configures the event name that deactivates the Pressable when onMouseLeave is triggered

Default: 'onMouseLeave'
release
String

Configures the event name that deactivates the Pressable

Default: 'onMouseUp'
prop
String

Configures the property that is passed to the wrapped component when pressed

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

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

Default: false
disabled
Boolean

Whether or not the component is in a disabled state.

Default: false
prop
Boolean

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" and Pressable will manage the pressed state using callbacks defined by its configuration.

ArrayBooleanFunctionModuleNumberObjectString