Components
Pressable

Pressable

Pressable handles press interactions across mouse, touch, keyboard, and screen readers.

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

PressableProps

allowTextSelectionOnPress

boolean

Whether text selection should be enabled on the pressable element.

cancelOnPointerExit

boolean

Whether press events should be canceled when the pointer leaves the target while pressed. By default, this is `false`, which means if the pointer returns back over the target while still pressed, onPressStart will be fired again. If set to `true`, the press is canceled when the pointer leaves the target and onPressStart will not be fired if the pointer returns.

dir

'ltr' | 'rtl'

The document's text/writing direction.

disabled

boolean

Whether the element is disabled

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

id

string

The unique identifier of the machine.

longPressDelay

number

The amount of time (in milliseconds) to wait before firing the `onLongPress` event.

onLongPress

(event: PressEvent) => void

Handler that is called when the element has been pressed for 500 milliseconds

onPress

(event: PressEvent) => void

Handler that is called when the press is released over the target.

onPressEnd

(event: PressEvent) => void

Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.

onPressStart

(event: PressEvent) => void

Handler that is called when a press interaction starts.

onPressUp

(event: PressEvent) => void

Handler that is called when a press is released over the target, regardless of whether it started on the target or not.

preventFocusOnPress

boolean

Whether the target should not receive focus on press.

UsePressableProps

allowTextSelectionOnPress

boolean

Whether text selection should be enabled on the pressable element.

cancelOnPointerExit

boolean

Whether press events should be canceled when the pointer leaves the target while pressed. By default, this is `false`, which means if the pointer returns back over the target while still pressed, onPressStart will be fired again. If set to `true`, the press is canceled when the pointer leaves the target and onPressStart will not be fired if the pointer returns.

dir

'ltr' | 'rtl'

The document's text/writing direction.

disabled

boolean

Whether the element is disabled

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

id

string

The unique identifier of the machine.

longPressDelay

number

The amount of time (in milliseconds) to wait before firing the `onLongPress` event.

onLongPress

(event: PressEvent) => void

Handler that is called when the element has been pressed for 500 milliseconds

onPress

(event: PressEvent) => void

Handler that is called when the press is released over the target.

onPressEnd

(event: PressEvent) => void

Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.

onPressStart

(event: PressEvent) => void

Handler that is called when a press interaction starts.

onPressUp

(event: PressEvent) => void

Handler that is called when a press is released over the target, regardless of whether it started on the target or not.

preventFocusOnPress

boolean

Whether the target should not receive focus on press.

UsePressableReturn

isPressed

boolean

Whether the element is pressed.

pressableProps

Dict<any>