Reference version

This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 52).

Expo UI

GitHub

npm

A set of platform components to build native-feeling UIs.

Android
iOS

@expo/ui is a set of native input components that allows you to build fully native interfaces with SwiftUI and Jetpack Compose.

This library is currently in alpha and subject to breaking changes. It is unavailable in the Expo Go app, and you should use development builds.

Installation

Terminal
- npx expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

Examples

BottomSheet component

import { BottomSheet } from '@expo/ui/BottomSheet';

<BottomSheet isOpen={isOpen} onIsOpenedChange={e => setIsOpened(e)}>
  <Text>Hello, world!</Text>
</BottomSheet>

Button component

import { Button } from '@expo/ui/Button';

<Button
  style={{ flex: 1 }}
  onPress={() => {
    setEditingProfile(true);
  }}>
  Edit profile
</Button>

ColorPicker component

import { ColorPicker } from '@expo/ui/ColorPicker';

<ColorPicker
  label="Select a color"
  selection={color}
  onValueChanged={setColor}
  style={{ width: 400, height: 200 }}
/>

DateTimePicker component (date variant)

import { DateTimePicker } from '@expo/ui/DateTimePicker';

<DateTimePicker
  onDateSelected={date => {
    setSelectedDate(date);
  }}
  displayedComponents='date'
  initialDate={selectedDate.toISOString()}
  iosVariant='wheel'
  androidVariant='picker'
/>

Gauge component

import { Gauge } from "@expo/ui/Gauge";

<Gauge
  max={{ value: 1, label: '1' }}
  min={{ value: 0, label: '0' }}
  current={{ value: 0.5 }}
  color={[
    PlatformColor('systemRed'),
    PlatformColor('systemOrange'),
    PlatformColor('systemYellow'),
    PlatformColor('systemGreen'),
  ]}
  type="circular"
/>

LinearProgress component

import { LinearProgress } from '@expo/ui/LinearProgress';

<LinearProgress progress={0.5} style={{ width: 300 }} />

Picker component (segmented variant)

import { Picker } from '@expo/ui/Picker';

<Picker
  options={['$', '$$', '$$$', '$$$$']}
  selectedIndex={selectedIndex}
  onOptionSelected={({ nativeEvent: { index } }) => {
    setSelectedIndex(index);
  }}
/>

Picker component (wheel variant) (iOS only)

import { Picker } from '@expo/ui/Picker';

<Picker
  options={['$', '$$', '$$$', '$$$$']}
  selectedIndex={selectedIndex}
  onOptionSelected={({ nativeEvent: { index } }) => {
    setSelectedIndex(index);
  }}
  variant="wheel"
  style={{
    height: 100,
  }}
/>

Switch component

import { Switch } from '@expo/ui/Switch';

<Switch
  checked={checked}
  onValueChange={checked => {
    setChecked(checked);
  }}
  label="Play music"
/>

Switch component (checkbox variant)

import { Switch } from '@expo/ui/Switch';

<Switch
  checked={checked}
  onValueChange={checked => {
    setChecked(checked);
  }}
  label="Play music"
  variant="checkbox"
/>

TextInput component

import { TextInput } from '@expo/ui/TextInput';

<TextInput autocorrection={false} defaultValue="A single line text input" onChangeText={setValue} />

Components

BottomSheet

iOS

Type: React.Element<BottomSheetProps>

Renders a native BottomSheet component.

BottomSheetProps

children

iOS
Type: any

The children of the BottomSheet component.

isOpened

iOS
Type: boolean

Whether the BottomSheet is opened.

onIsOpenedChange

iOS
Type: (isOpened: boolean) => void

Callback function that is called when the BottomSheet is opened.

style

iOS
Optional • Type: StyleProp<ViewStyle>

Optional styles to apply to the BottomSheet component.

Button

Android
iOS

Type: React.Element<ButtonProps>

Displays a native button component.

ButtonProps

children

Android
iOS
Type: string

The text to display inside the button.

color

Android
iOS
Optional • Type: string

Button color.

disabled

Android
iOS
Optional • Type: boolean

Disabled state of the button.

elementColors

Android
Optional • Type: ButtonElementColors

Colors for button's core elements.

onPress

Android
iOS
Optional • Type: () => void

A callback that is called when the button is pressed.

role

iOS
Optional • Type: ButtonRole

Indicated the role of the button.

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Additional styles to apply to the button.

systemImage

Android
iOS
Optional • Type: { android: MaterialIcon, ios: string }

A string describing the system image to display in the button. Uses Material Icons on Android and SF Symbols on iOS.

variant

Android
iOS
Optional • Type: ButtonVariant

The button variant.

CircularProgress

Android
iOS

Type: React.Element<CircularProgressProps>

Renders a CircularProgress component.

CircularProgressProps

color

Android
iOS
Optional • Type: ColorValue

Progress color.

elementColors

Android
Optional • Type: ProgressElementColors

Colors for switch's core elements.

progress

Android
iOS
Optional • Literal type:

The current progress value of the slider. This is a number between 0 and 1.

Acceptable values are: number | null

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Custom styles for the progress component.

ColorPicker

iOS

Type: React.Element<ColorPickerProps>

Renders a ColorPicker component using SwiftUI.

ColorPickerProps

label

iOS
Optional • Type: string

A label displayed on the ColorPicker.

onValueChanged

iOS
Optional • Type: (value: string) => void

Callback function that is called when a new color is selected.

selection

iOS
Literal type:

The currently selected color in the format #RRGGBB or #RRGGBBAA.

Acceptable values are: string | null

style

iOS
Optional • Type: StyleProp<ViewStyle>

Optional style to apply to the ColorPicker component.

supportsOpacity

iOS
Optional • Type: boolean

Whether the color picker should support opacity.

ContextMenu

Android
iOS

Type: React.Element<ContextMenuProps>

ContextMenu allows you to create a context menu, which can be used to provide additional options to the user.

There are some platform-specific differences in the behavior of the context menu:

  • On Android, the expansion of the context menu is controlled by the expanded prop. iOS, does not allow for manual control of the expansion state.
  • On iOS, the context menu can be triggered by a single press or a long press. The activationMethod prop allows you to choose between these two options.
  • Android does not support nesting in the context menu. All the submenus will be flat-mapped into a single level with multiple sections. The title prop of the Button, which opens the submenu on iOS will be used as a section title.
  • Android does not support showing a Picker element in the context menu.

Props of the ContextMenu component.

ContextMenuProps

activationMethod

iOS
Optional • Type: ActivationMethod

Determines how the context menu will be activated.

children

Android
iOS
Type: ReactNode

The contents of the submenu are used as an anchor for the context menu. The children will be wrapped in a pressable element, which triggers opening of the context menu.

color

Android
Optional • Type: string

The color of the container holding the context menu items.

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Optional styles to apply to the ContextMenu.

DateTimePicker

Android
iOS

Type: React.Element<DateTimePickerProps>

Renders a DateTimePicker component.

DateTimePickerProps

androidVariant

Android
Optional • Type: AndroidVariant • Default: 'picker'

The variant of the picker, which determines its appearance and behavior.

color

Android
iOS
Optional • Type: string

The tint color to use on the picker elements.

displayedComponents

Android
iOS
Optional • Type: DisplayedComponents • Default: 'date'

The components that the picker should display. On Android, you can have a picker that selects just the date or just the time. dateAndTime is only available on iOS and will result in a date picker on Android. On iOS, you can have a picker that selects both date and time.

initialDate

Android
iOS
Optional • Literal type:

The initial date to display on the picker.

Acceptable values are: string | null

iosVariant

iOS
Optional • Type: IOSVariant • Default: 'automatic'

The variant of the picker, which determines its appearance and behavior.

is24Hour

Android
Optional • Type: boolean • Default: true

Determines what format the clock should be displayed in on Android.

onDateSelected

Android
iOS
Optional • Type: (date: Date) => void

Callback function that is called when a date is selected.

showVariantToggle

Android
Optional • Type: boolean • Default: true

Show to button to toggle between variants on Android.

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Optional style to apply to the component.

title

iOS
Optional • Type: string

A title displayed on the picker on iOS.

Gauge

iOS

Type: React.Element<GaugeProps>

Renders a native Gauge component.

GaugeProps

color

iOS
Optional • Literal type:

Color (or array of colors for gradient) of the Gauge.

Acceptable values are: ColorValue | ColorValue[]

current

iOS

Current value options.

label

iOS
Optional • Type: string

A label displayed on the Gauge.

labelColor

iOS
Optional • Type: ColorValue

Color of the label.

max

iOS
Optional • Type: ValueOptions

Maximum value options.

min

iOS
Optional • Type: ValueOptions

Minimum value options.

style

iOS
Optional • Type: StyleProp<ViewStyle>

Optional style to apply to the Gauge component.

type

iOS
Optional • Type: GaugeType

The type of Gauge.

Items

Android
iOS

Type: React.Element<{ children: ReactNode }>

Items visible inside the context menu. Pass input components as immidiate children of the tag. Button, Switch and Submenu components are supported on both Android and iOS. The Picker component is supported only on iOS. Remember to use components from the @expo/ui library.

Label

iOS

Type: React.Element<LabelProps>

Renders a native label view, which could be used in a List or Section.

LabelProps

color

iOS
Optional • Type: string

The color of the label icon.

style

iOS
Optional • Type: StyleProp<ViewStyle>

Additional styles to apply to the label.

systemImage

iOS
Optional • Type: string

The name of the SFSymbol to be displayed in the label.

title

iOS
Optional • Type: string

The title text to be displayed in the label.

LinearProgress

Android
iOS

Type: React.Element<LinearProgressProps>

Renders a LinearProgress component.

LinearProgressProps

color

Android
iOS
Optional • Type: ColorValue

Progress color.

elementColors

Android
Optional • Type: ProgressElementColors

Colors for switch's core elements.

progress

Android
iOS
Optional • Literal type:

The current progress value of the slider. This is a number between 0 and 1.

Acceptable values are: number | null

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Custom styles for the progress component.

List

iOS

Type: React.Element<ListProps>

A list component that renders its children using a native SwiftUI list.

ListProps

children

iOS
Type: ReactNode

The children elements to be rendered inside the list.

deleteEnabled

iOS
Optional • Type: boolean • Default: false

Allows the deletion of list items.

editModeEnabled

iOS
Optional • Type: boolean • Default: false

Enables SwiftUI edit mode.

listStyle

iOS
Optional • Type: ListStyle • Default: 'automatic'

One of the predefined ListStyle types in SwiftUI.

moveEnabled

iOS
Optional • Type: boolean • Default: false

Enables reordering of list items.

onDeleteItem

iOS
Optional • Type: (index: number) => void

Callback triggered when an item is deleted from the list.

onMoveItem

iOS
Optional • Type: (from: number, to: number) => void

Callback triggered when an item is moved in the list.

onSelectionChange

iOS
Optional • Type: (selection: number[]) => void

Callback triggered when the selection changes in a list.

scrollEnabled

iOS 16.0+
Optional • Type: boolean • Default: true

Makes the list scrollable.

selectEnabled

iOS
Optional • Type: boolean • Default: false

Allows the selection of list items.

style

iOS
Optional • Type: StyleProp<ViewStyle>

Custom style for the container wrapping the list.

Picker

Android
iOS

Type: React.Element<PickerProps>

Displays a native picker component. Depending on the variant it can be a segmented button, an inline picker, a list of choices or a radio button.

PickerProps

color

Android
iOS
Optional • Type: string

Picker color. On iOS it only applies to the 'menu' variant.

elementColors

Android
Optional • Type: PickerElementColors

Colors for picker's core elements.

label

iOS
Optional • Type: string

A label displayed on the picker when in 'menu' variant inside a form section on iOS.

onOptionSelected

Android
iOS
Optional • Type: (event: { nativeEvent: { index: number, label: string } }) => void

Callback function that is called when an option is selected.

options

Android
iOS
Type: string[]

An array of options to be displayed in the picker.

selectedIndex

Android
iOS
Literal type:

The index of the currently selected option.

Acceptable values are: number | null

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Optional style to apply to the picker component.

variant

Android
iOS
Optional • Literal type: string • Default: 'segmented'

The variant of the picker, which determines its appearance and behavior. The 'wheel', 'inline', 'palette' and 'menu' variants are iOS only, the 'radio' variant is Android only. The 'inline' variant can only be used inside sections or lists. The 'palette' variant displays differently inside menus.

Acceptable values are: 'wheel' | 'segmented' | 'menu' | 'radio' | 'inline' | 'palette'

Preview

iOS

Type: React.Element<{ children: ReactNode }>

The component visible above the menu when it is opened.

Section

iOS

Type: React.Element<SectionProps>

Section component uses the native Section component. It has no intrinsic dimensions, so it needs explicit height or flex set to display content (like ScrollView).

SectionProps

children

iOS
Type: any

style

iOS
Optional • Type: StyleProp<ViewStyle>

title

iOS
Optional • Type: string

On iOS, section titles are usually capitalized for consistency with platform conventions.

Slider

Android
iOS

Type: React.Element<SliderProps>

SliderProps

color

Android
iOS
Optional • Type: string

Slider color.

elementColors

Android
Optional • Type: SliderElementColors

Colors for slider's core elements.

max

Android
iOS
Optional • Type: number • Default: 1

The maximum value of the slider. Updating this value does not trigger callbacks if the current value is above max.

min

Android
iOS
Optional • Type: number • Default: 0

The minimum value of the slider. Updating this value does not trigger callbacks if the current value is below min.

onValueChange

Android
iOS
Optional • Type: (value: number) => void

Callback triggered on dragging along the slider.

steps

Android
iOS
Optional • Type: number • Default: 0

The number of steps between the minimum and maximum values, 0 signifies infinite steps.

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Custom styles for the slider component.

value

Android
iOS
Optional • Type: number • Default: 0

The current value of the slider.

Submenu

Android
iOS

Type: React.Element<SubmenuProps>

The Submenu component is used to create a nested context menu. Submenus can be infinitely nested. Android does not support nesting in the context menu. All the submenus will be flat-mapped into a single level with multiple titled sections.

Props of the Submenu component.

SubmenuProps

button

Android
iOS

The button that will be used to expand the submenu. On Android the text prop of the Button will be used as a section title.

children

Android
iOS
Type: ReactNode

Children of the submenu. Only Button, Switch, Picker and Submenu elements should be used.

Switch

Android
iOS

Type: React.Element<SwitchProps>

SwitchProps

color

Android
iOS
Optional • Type: string

Picker color. On iOS, it only applies to the menu variant.

label

iOS
Optional • Type: string

Label for the switch.

On Android, the label has an effect only when the Switch is used inside a ContextMenu.

onValueChange

Android
iOS
Optional • Type: (value: boolean) => void

Callback function that is called when the checked state changes.

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Optional style for the switch component.

value

Android
iOS
Type: boolean

Indicates whether the switch is checked.

variant

Android
iOS
Optional • Literal type: string • Default: 'switch'

Type of the switch component. Can be 'checkbox', 'switch', or 'button'. The 'button' style is iOS only.

Acceptable values are: 'checkbox' | 'switch' | 'button'

TextInput

Android
iOS

Type: React.Element<TextInputProps>

Renders a TextInput component.

TextInputProps

autocorrection

Android
iOS
Optional • Type: boolean • Default: true

If true, autocorrection is enabled.

defaultValue

Android
iOS
Optional • Type: string

Initial value that the TextInput displays when being mounted. As the TextInput is an uncontrolled component, change the key prop if you need to change the text value.

keyboardType

Android
iOS
Optional • Literal type: string • Default: default

Determines which keyboard to open. For example, 'numeric'.

Types that work on both platforms:

  • default
  • numeric
  • email-address
  • phone-pad
  • decimal-pad
  • ascii-capable
  • url

Types that only work on Android:

  • password
  • password-numeric

Types that only work on iOS:

  • numbers-and-punctuation
  • name-phone-pad
  • twitter
  • web-search
  • ascii-capable-number-pad

Acceptable values are: 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'ascii-capable' | 'numbers-and-punctuation' | 'url' | 'name-phone-pad' | 'decimal-pad' | 'twitter' | 'web-search' | 'ascii-capable-number-pad'

multiline

Android
iOS
Optional • Type: boolean

If true, the text input can be multiple lines. While the content will wrap, there's no keyboard button to insert a new line.

numberOfLines

Android
iOS
Optional • Type: number • Default: undefined, which means unlimited lines.

The number of lines to display when multiline is set to true. If the number of lines in the view is above this number, the view scrolls.

onChangeText

Android
iOS
Type: (value: string) => void

A callback triggered when user types in text into the TextInput.

style

Android
iOS
Optional • Type: StyleProp<ViewStyle>

Additional styles to apply to the TextInput.

Trigger

Android
iOS

Type: React.Element<{ children: ReactNode }>

The component visible all the time that triggers the menu when tapped or long-pressed.

Types

ActivationMethod

Android
iOS

Literal Type: string

Activation method of the context menu.

  • singlePress: The context menu is opened with a single tap. Does not isolate the content.
  • longPress: The context menu is opened with a long press. On iOS additionally Highlights the content by blurring the background.

Acceptable values are: 'singlePress' | 'longPress'

AndroidVariant

Android
iOS

Literal Type: string

Acceptable values are: 'picker' | 'input'

ButtonElementColors

Android

Colors for button's core elements.

PropertyTypeDescription
containerColor(optional)string-
contentColor(optional)string-
disabledContainerColor(optional)string-
disabledContentColor(optional)string-

ButtonRole

iOS

Literal Type: string

The role of the button.

  • default - The default button role.
  • cancel - A button that cancels the current operation.
  • destructive - A button that deletes data or performs a destructive action.

Acceptable values are: 'default' | 'cancel' | 'destructive'

ButtonVariant

Android
iOS

Literal Type: string

The built-in button styles available on iOS and Android.

Common styles:

  • default - The default system button style.
  • bordered - A button with a light fill. On Android, equivalent to FilledTonalButton.
  • borderless - A button with no background or border. On Android, equivalent to TextButton.

Android-only styles:

  • outlined - A button with an outline.
  • elevated - A filled button with a shadow.

Apple-only styles:

  • borderedProminent - A bordered button with a prominent appearance.
  • plain - A button with no border or background and a less prominent text. macOS-only styles:
  • accessoryBar - A button style for accessory bars.
  • accessoryBarAction - A button style for accessory bar actions.
  • card - A button style for cards.
  • link - A button style for links.

Acceptable values are: 'default' | 'bordered' | 'plain' | 'borderedProminent' | 'borderless' | 'accessoryBar' | 'accessoryBarAction' | 'card' | 'link' | 'outlined' | 'elevated'

DisplayedComponents

Android
iOS

Literal Type: string

Acceptable values are: 'date' | 'hourAndMinute' | 'dateAndTime'

GaugeType

iOS

Literal Type: string

The type of Gauge.

Acceptable values are: 'default' | 'circular' | 'circularCapacity' | 'linear' | 'linearCapacity'

IOSVariant

Android
iOS

Literal Type: string

Acceptable values are: 'wheel' | 'automatic' | 'graphical' | 'compact'

ListStyle

Android
iOS

Literal Type: string

Acceptable values are: 'automatic' | 'plain' | 'inset' | 'insetGrouped' | 'grouped' | 'sidebar'

PickerElementColors

Android

Colors for picker's core elements.

PropertyTypeDescription
activeBorderColor(optional)string-
activeContainerColor(optional)string-
activeContentColor(optional)string-
disabledActiveBorderColor(optional)string-
disabledActiveContainerColor(optional)string-
disabledActiveContentColor(optional)string-
disabledInactiveBorderColor(optional)string-
disabledInactiveContainerColor(optional)string-
disabledInactiveContentColor(optional)string-
inactiveBorderColor(optional)string-
inactiveContainerColor(optional)string-
inactiveContentColor(optional)string-

ProgressElementColors

Android
iOS
PropertyTypeDescription
trackColor(optional)ColorValue
Only for: 
Android

Track color.

SliderElementColors

Android

Colors for slider's core elements.

PropertyTypeDescription
activeTickColor(optional)string-
activeTrackColor(optional)string-
inactiveTickColor(optional)string-
inactiveTrackColor(optional)string-
thumbColor(optional)string-

ValueOptions

iOS

Value options for the Gauge component.

PropertyTypeDescription
color(optional)ColorValue

Color of the label.

label(optional)string

Label of the element.

valuenumber

Value of the element.