import { BottomSheet, Button, Text } from "@vortexlabs/vortex-native";
export const BottomSheetDeliveryExample = () => (
<BottomSheet.Root>
<BottomSheet.Trigger>
{({ onPress, "aria-expanded": expanded }) => (
<Button onPress={onPress} attributes={{ "aria-expanded": expanded }}>Delivery options</Button>
)}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close sheet">
Delivery options
</BottomSheet.Header>
<BottomSheet.Body>
<Text>Standard delivery takes three business days.</Text>
</BottomSheet.Body>
<BottomSheet.Footer>
<BottomSheet.Close>
{({ onPress }) => <Button onPress={onPress}>Done</Button>}
</BottomSheet.Close>
</BottomSheet.Footer>
</BottomSheet.Content>
</BottomSheet.Root>
);Features
- Fits a short task to its content or expands through snap points.
- Keeps footer actions visible while the body scrolls.
- Opens a second sheet above the first.
Anatomy
<BottomSheet.Root>
<BottomSheet.Trigger>
{({ onPress }) => <Button onPress={onPress}>Open</Button>}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close">Options</BottomSheet.Header>
<BottomSheet.Body>
<BottomSheet.NestedRoot>
<BottomSheet.Trigger>
{({ onPress }) => <Button onPress={onPress}>More options</Button>}
</BottomSheet.Trigger>
<BottomSheet.Content ariaLabel="More options" />
</BottomSheet.NestedRoot>
</BottomSheet.Body>
<BottomSheet.Footer>
<BottomSheet.Close>
{({ onPress }) => <Button onPress={onPress}>Done</Button>}
</BottomSheet.Close>
</BottomSheet.Footer>
</BottomSheet.Content>
</BottomSheet.Root>Component Part
Description
Shares visibility and snap points.
Opens the sheet.
Displays the draggable panel.
Names the sheet and holds navigation actions.
Scrolls the main content.
Opens another sheet above the current one.
Keeps actions below the scrolling body.
Connects a custom action to dismissal.
Variants
Use variant to change the backdrop. The blurred variant uses the provider’s blur adapter.
<Stack direction="row" gap={2} wrap>
{(["dim", "blurred", "transparent"] as const).map((variant) => (
<BottomSheet.Root key={variant} variant={variant}>
<BottomSheet.Trigger>
{({ onPress, "aria-expanded": expanded }) => (
<Button onPress={onPress} attributes={{ "aria-expanded": expanded }}>{variant}</Button>
)}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close pickup point">Pickup point</BottomSheet.Header>
<BottomSheet.Body><Text>North entrance, counter 4.</Text></BottomSheet.Body>
</BottomSheet.Content>
</BottomSheet.Root>
))}
</Stack>Detached
Set detached to leave space between the sheet and the screen edges.
<BottomSheet.Root detached>
<BottomSheet.Trigger>
{({ onPress, "aria-expanded": expanded }) => (
<Button onPress={onPress} attributes={{ "aria-expanded": expanded }}>View collection code</Button>
)}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close collection code">Collection code</BottomSheet.Header>
<BottomSheet.Body><Text>Show code B27 at the counter.</Text></BottomSheet.Body>
</BottomSheet.Content>
</BottomSheet.Root>Dismissal
Set dismissible={false} to keep the sheet open on backdrop presses, swipes, and Android Back. Provide a close action.
<BottomSheet.Root dismissible={false}>
<BottomSheet.Trigger>
{({ onPress, "aria-expanded": expanded }) => (
<Button onPress={onPress} attributes={{ "aria-expanded": expanded }}>Read pickup policy</Button>
)}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close pickup policy">Pickup policy</BottomSheet.Header>
<BottomSheet.Body><Text>Bring a photo ID when collecting your order.</Text></BottomSheet.Body>
</BottomSheet.Content>
</BottomSheet.Root>Snap Points
Use fractions for a share of the window height or a string such as "320px" for a height in points. The grabber cycles between heights.
import { BottomSheet, Button, Text } from "@vortexlabs/vortex-native";
export const BottomSheetHeightsExample = () => (
<BottomSheet.Root snapPoints={[0.4, 0.8]} grabberAriaLabel="Resize order details">
<BottomSheet.Trigger>
{({ onPress, "aria-expanded": expanded }) => (
<Button onPress={onPress} attributes={{ "aria-expanded": expanded }}>Resize sheet</Button>
)}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close sheet">
Order details
</BottomSheet.Header>
<BottomSheet.Body>
<Text>Order 1042 ships on Friday.</Text>
</BottomSheet.Body>
</BottomSheet.Content>
</BottomSheet.Root>
);Nested Sheets
Use BottomSheet.NestedRoot inside the first sheet to keep its place while people complete a second task.
import { BottomSheet, Button, Text } from "@vortexlabs/vortex-native";
export const BottomSheetNestedExample = () => (
<BottomSheet.Root>
<BottomSheet.Trigger>
{({ onPress, "aria-expanded": expanded }) => (
<Button onPress={onPress} attributes={{ "aria-expanded": expanded }}>Choose pickup</Button>
)}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close sheet">
Pickup details
</BottomSheet.Header>
<BottomSheet.Body>
<BottomSheet.NestedRoot>
<BottomSheet.Trigger>
{({ onPress, "aria-expanded": expanded }) => (
<Button onPress={onPress} attributes={{ "aria-expanded": expanded }}>Choose time</Button>
)}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close sheet">
Pickup time
</BottomSheet.Header>
<BottomSheet.Body>
<Text>9 am to noon</Text>
</BottomSheet.Body>
</BottomSheet.Content>
</BottomSheet.NestedRoot>
</BottomSheet.Body>
</BottomSheet.Content>
</BottomSheet.Root>
);Open State
Set open and update it in onOpenChange to control the sheet from your screen.
const [open, setOpen] = useState(false);
// In your component’s JSX:
<BottomSheet.Root open={open} onOpenChange={setOpen}>
<BottomSheet.Trigger>
{({ onPress }) => <Button onPress={onPress}>Order details</Button>}
</BottomSheet.Trigger>
<BottomSheet.Content>
<BottomSheet.Header closeAriaLabel="Close order">Order details</BottomSheet.Header>
<BottomSheet.Body><Text>Order 1042 ships on Friday.</Text></BottomSheet.Body>
</BottomSheet.Content>
</BottomSheet.Root>Accessibility
Description
The header title names the sheet. Supply
ariaLabel on BottomSheet.Content when you omit the title.Supply
closeAriaLabel for the header close button and backAriaLabel when using onBack.