Skip to content

Button

const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<ButtonHandle>>;

Focusable button that triggers an action on Enter or Space.

<Button
label="Save"
onPress={() => save()}
style={{ border: "round", paddingX: 2 }}
focusedStyle={{ bg: "cyan", color: "black" }}
/>
// Using children for custom content
<Button onPress={handleClick}>
<Text style={{ bold: true }}>🚀 Launch</Text>
</Button>

PropertyTypeDescription
children?ReactNodeCustom content. Takes precedence over label when both are provided.
disabled?booleanWhen true, the button is skipped in the focus order and ignores input.
focusedStyle?StyleStyle applied when the button is focused (merged with style).
label?stringShorthand text label. When provided and children is absent, renders the label as text.
onPress?() => voidCallback fired when the button is activated (Enter or Space).
style?StyleBase style for the button container.

Handle for Button

blur(): void;

Programmatically blur (unfocus) this element

void

FocusableHandle.blur


focus(): void;

Programmatically focus this element

void

FocusableHandle.focus


scrollIntoView(options?): void;

Scroll the nearest parent ScrollView to make this element visible. Behaves like the DOM Element.scrollIntoView() method. No-op if the element is not inside a ScrollView.

ParameterTypeDescription
options?ScrollIntoViewOptionsAlignment options (default: { block: "nearest" })

void

const inputRef = useRef<InputHandle>(null);
// Minimal scroll — just enough to make it visible
inputRef.current?.scrollIntoView();
// Center the element in the viewport
inputRef.current?.scrollIntoView({ block: "center" });

FocusableHandle.scrollIntoView

PropertyModifierTypeDescriptionInherited from
isFocusedreadonlybooleanWhether this element is currently focusedFocusableHandle.isFocused