React Native · Components
Button
Button.
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Import
Button
componentButton. Same API as web's Button: variant, tone, size, shape, icon, loading, effect, tooltip, and an automatic loading state with an onPress that returns a Promise. Looks the same on Android and iOS (shadows and gradients via RN's platform-independent boxShadow and backgroundImage styles, effects drawn on the native driver). The touch target is at least 44×44 pixels.
- For app-wide variant, color, size, shape and effect use
UIProviderappearance.defaults.button; for your own variantsappearance.variants.button(the style'scolorfield is the text and icon color). - Inside a
ButtonGroup, missingvariant,tone,sizeanddisabledcome from the group. - For icon-only buttons use
IconButton.
Examples
IconButton
componentSquare icon-only button (web's IconButton). Its height matches text buttons via size; the variant defaults to ghost (the group's variant inside a ButtonGroup). Its name shows as a tooltip on press and hold.
Examples
ButtonGroup
componentBrings related buttons together as a single piece (same API as web's ButtonGroup): toolbars, split buttons (Save + ▾), view switchers, alignment and formatting buttons.
- Two ways to use: put your own
Button/IconButton/Menuelements inchildren, or pass anitemsarray and let the group render the buttons. Selection mode, split buttons and the "More" menu work withitems. - Attached (default): inner corners are removed, borders overlap, and solid buttons get a thin line between them.
- Selection mode:
selection="single"is single-select,"multiple"multi-select; pressed buttons carryaria-pressedand look highlighted. - Phone: with
overflow="menu"buttons that do not fit move into a trailing ⋯ menu; recalculated when the width changes (rotation, split screen); measurements are cached so it does not flicker.
Examples
ButtonVariant
typeButton variant (same names and look as web's ButtonVariant).
solid: filled; the primary action on the screen.soft: tinted background; a secondary but colored action.outline: bordered.ghost: no background; toolbars and lists.link: text like a link.gradient: a filled button with a subtle gradient from the tone color.elevated: shadowed, raised from the surface.dashed: dashed border; placeholder actions like "add".
ButtonShape
typeCorner shape: rounded theme radius, pill fully round, sharp square corners.
ButtonProps
interfaceProps of Button.
Extends: Omit<PressableProps, "children" | "style" | "onPress">
| Name | Type | Default | Description |
|---|---|---|---|
ref? | Ref<ViewRef> | Ref of the underlying native element. | |
children? | ReactNode | Button text or content. | |
variant? | ButtonVariant | (string & {}) | "solid" | Variant: one of the built-in variants (ButtonVariant) or a name added via UIProvider appearance.variants.button. If omitted, the ButtonGroup's variant is used, then appearance.defaults.button. |
tone? | Tone | "primary" | Color: the meaning of the action. |
size? | Size | "md" | Height: sm 32, md 40, lg 48 pixels. |
shape? | ButtonShape | "rounded"` (or `appearance.defaults.button.shape`) | Corner shape. |
effect? | EffectProp | Effect or effects: on press scale, ripple, pulse, bounce; while pressed lift, border, beam, glow, tilt, shine; or a custom effect added via appearance.effects. Can be combined as an array (["ripple", "glow"]). Defaults to appearance.defaults.button.effect, otherwise scale (no effect for the link variant). "none" turns all off. See BuiltinEffect. | |
tooltip? | TooltipProp | Tooltip shown on press and hold: text, content or settings ({ content, side, touch }). Works while the button is disabled too; useful to explain why it cannot be pressed. See TooltipProp. | |
icon? | IconProp | Icon before the text. See IconProp. | |
iconEnd? | IconProp | Icon after the text. | |
loading? | boolean | Loading: a spinner instead of the icon, cannot be pressed. | |
block? | boolean | Fills its row. | |
onPress? | (event: GestureResponderEvent) => unknown | Called on press. If it returns a Promise the button shows loading automatically until it settles (same behavior as web's onClick). | |
accessibilityLabel? | string | Screen reader label; should be considered required only on icon-only buttons. | |
style? | StyleProp<ViewStyle> | Container style. |
IconButtonProps
interfaceProps of IconButton.
Extends: Omit<Omit<PressableProps, "children" | "style" | "onPress">, "children" | "iconEnd" | "block" | "accessibilityLabel">
| Name | Type | Default | Description |
|---|---|---|---|
icon | IconProp | Icon shown on the button: a name ("trash") or an element. | |
label | string | Name of the button. Screen readers read it; shown as a tooltip on press and hold. Required, because an icon alone is not a name. | |
tooltip? | TooltipProp | Tooltip. Defaults to label; use it to give a different text or settings, turn it off with false. | |
ref? | Ref<ViewRef> | Ref of the underlying native element. | |
variant? | ButtonVariant | (string & {}) | "solid" | Variant: one of the built-in variants (ButtonVariant) or a name added via UIProvider appearance.variants.button. If omitted, the ButtonGroup's variant is used, then appearance.defaults.button. |
tone? | Tone | "primary" | Color: the meaning of the action. |
size? | Size | "md" | Height: sm 32, md 40, lg 48 pixels. |
shape? | ButtonShape | "rounded"` (or `appearance.defaults.button.shape`) | Corner shape. |
effect? | EffectProp | Effect or effects: on press scale, ripple, pulse, bounce; while pressed lift, border, beam, glow, tilt, shine; or a custom effect added via appearance.effects. Can be combined as an array (["ripple", "glow"]). Defaults to appearance.defaults.button.effect, otherwise scale (no effect for the link variant). "none" turns all off. See BuiltinEffect. | |
loading? | boolean | Loading: a spinner instead of the icon, cannot be pressed. | |
onPress? | (event: GestureResponderEvent) => unknown | Called on press. If it returns a Promise the button shows loading automatically until it settles (same behavior as web's onClick). | |
style? | StyleProp<ViewStyle> | Container style. |
ButtonGroupItem
interfaceA button in the ButtonGroup items array (same fields as web).
| Name | Type | Description |
|---|---|---|
value? | V | ID of the item. In selection mode (selection) this is the selected value; also used as the React key. Required in selection mode. |
label | ReactNode | Button text. With iconOnly it must be given as text; it becomes the screen reader name and tooltip. |
icon? | IconProp | Icon at the start of the text: a name or an element. |
iconEnd? | IconProp | Icon at the end of the text. |
iconOnly? | boolean | Shows only the icon (square button, IconButton); label becomes the name and tooltip. |
tone? | Tone | This button's color; defaults to the group's color. |
disabled? | boolean | Cannot be pressed. Locks this item regardless of the group's disabled. |
loading? | boolean | Loading state. Happens automatically when onPress returns a Promise. |
tooltip? | TooltipProp | Tooltip (on press and hold). See TooltipProp. |
onPress? | (event: GestureResponderEvent | undefined) => unknown | Called on press. If it returns a Promise the button shows loading automatically. In selection mode it is called after the selection changes. If the item moved into the "More" menu, it is also called when chosen from the menu. |
menu? | readonly MenuEntry[] | When given, the button opens a menu (like the arrow part of a split button). |
style? | StyleProp<ViewStyle> | Button style. |
What happens to buttons that do not fit in the group (same as web).
"none": Nothing; buttons stay on one line."wrap": They wrap to the next line. Only meaningful withattached={false}."menu": Those that do not fit move into a trailing "More actions" (⋯) menu (opens as a bottom sheet on phones). The group takes the full width of its area. Works only withitemsand in a horizontal group.
ButtonGroupProps
typeProps of ButtonGroup: an action group, single-select or multi-select group.
| Name | Type | Default | Description |
|---|---|---|---|
selection? | undefined | "single" | "multiple" | Selection mode off. | |
value? | undefined | V | null | V[] | Selected value(s) (controlled); only with selection. | |
defaultValue? | undefined | V | null | V[] | Initial selection; only with selection. | |
onValueChange? | undefined | (value: V | null) => void | (value: V[]) => void | Called when the selection changes; only with selection. | |
required? | undefined | boolean | boolean | Keeps a button pressed; only with selection. | |
ref? | Ref<ViewRef> | Ref of the container. | |
variant? | ButtonVariant | (string & {}) | Variant of the buttons inside (a button's own variant wins). | |
tone? | Tone | Color of the buttons inside. | |
size? | Size | Height of the buttons inside. | |
disabled? | boolean | Disables all buttons. | |
orientation? | "horizontal" | "vertical" | "horizontal" | Layout direction. |
attached? | boolean | true | Are the buttons attached? With true the inner corners are removed and borders merge; with false there is a gap between buttons. |
block? | boolean | Takes the full width of its area; buttons share the area equally. | |
label? | string | Screen reader name of the group (e.g. "Text alignment"). | |
overflow? | ButtonGroupOverflow | "none" | What happens to buttons that do not fit. See ButtonGroupOverflow. |
items? | readonly ButtonGroupItem[] | readonly ButtonGroupItem<V>[] | readonly ButtonGroupItem<V>[] | Buttons as an array. Selection mode, split buttons (menu) and overflow="menu" work this way. If omitted, children is rendered. | |
children? | ReactNode | Your own buttons: Button, IconButton, Menu with a button trigger. Missing variant, tone, size, disabled come from the group. | |
style? | StyleProp<ViewStyle> | Container style. | |
testID? | string | Test ID. |