This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
A Jetpack Compose Button component for displaying native buttons.
A button component for displaying native buttons.
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
import { Button } from '@expo/ui/jetpack-compose'; <Button variant="default" leadingIcon="filled.Edit" onPress={() => { setEditingProfile(true); }}> Edit profile </Button> {/* Button with both leading and trailing icons */} <Button variant="bordered" leadingIcon="filled.Add" trailingIcon="filled.ArrowForward" onPress={() => console.log('Action')}> Add Item </Button>
See Official Jetpack Compose documentation for more information.
API
Component
Type: React.Element<ButtonProps>
Displays a native button component.
unionThe text to display inside the button.
Acceptable values are: string | string[] | React.JSX.Element
MaterialIconA string describing the leading icon to display in the button. Uses Material Icons on Android.
ShapeJSXElementDeprecated Use
leadingIconinstead.
MaterialIconA string describing the system image to display in the button. Uses Material Icons on Android.
MaterialIconA string describing the trailing icon to display in the button. Uses Material Icons on Android.
Types
Colors for button's core elements.
| Property | Type | Description |
|---|---|---|
| containerColor(optional) | string | - |
| contentColor(optional) | string | - |
| disabledContainerColor(optional) | string | - |
| disabledContentColor(optional) | string | - |