Button
A pressable button with multiple visual variants.
For the complete documentation index, see llms.txt. Use this file to discover all available pages.
A pressable button that renders consistently across Android, iOS, and web. Supports filled, outlined, and text visual variants.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Basic button
import { Host, Button } from '@expo/ui'; export default function BasicButtonExample() { return ( <Host matchContents> <Button label="Press me" onPress={() => alert('Pressed!')} /> </Host> ); }
Variants
Pick a visual variant with the variant prop.
import { Host, Column, Button } from '@expo/ui'; export default function ButtonVariantsExample() { return ( <Host matchContents> <Column spacing={8}> <Button variant="filled" label="Filled" onPress={() => {}} /> <Button variant="outlined" label="Outlined" onPress={() => {}} /> <Button variant="text" label="Text" onPress={() => {}} /> </Column> </Host> ); }
Custom content
Pass children for fully custom button contents. The label prop is ignored when children is provided.
import { Host, Button, Row, Icon, Text } from '@expo/ui'; export default function CustomButtonExample() { return ( <Host matchContents> <Button onPress={() => {}}> <Row spacing={6} alignment="center"> <Icon name={Icon.select({ ios: 'star.fill', android: require('@expo/material-symbols/star.xml'), })} size={16} color="#FFFFFF" /> <Text textStyle={{ color: '#FFFFFF' }}>Favorite</Text> </Row> </Button> </Host> ); }
Disabled
import { Host, Button } from '@expo/ui'; export default function DisabledButtonExample() { return ( <Host matchContents> <Button label="Disabled" onPress={() => {}} disabled /> </Host> ); }
API
import { Button } from '@expo/ui';
Component
Type: React.Element<ButtonProps>
A pressable button that supports multiple visual variants.
Props for the Button component.
ReactNodeCustom content rendered inside the button. When provided, label is ignored.
booleanWhether the component is disabled. Disabled components do not respond to user interaction.
stringText label displayed inside the button. Ignored when children is provided.
ModifierConfig[]Platform-specific modifier escape hatch. Pass an array of modifier configs
from @expo/ui/swift-ui/modifiers or @expo/ui/jetpack-compose/modifiers.
() => voidCalled when the component is removed from screen.
Pick<ViewStyle, 'padding' | 'paddingHorizontal' | 'paddingVertical' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'backgroundColor' | 'borderRadius' | 'borderWidth' | 'borderColor' | 'opacity' | 'width' | 'height'>Platform-agnostic style properties. These are translated to SwiftUI modifiers on iOS and Jetpack Compose modifiers on Android.
stringIdentifier used to locate the component in end-to-end tests.
Types
Literal Type: string
Visual variant of a Button.
'filled'— solid background color (default).'outlined'— transparent background with a border.'text'— no background or border, text only.
Acceptable values are: 'filled' | 'outlined' | 'text'