React Native / Overlays
BottomSheet
Panel that slides up from the bottom for options or a short task. Drag it down or tap outside to close; screen reader users activate the handle, press back, or use the escape gesture. Opens without motion under Reduce Motion.
import { BottomSheet } from "@stylhero/native";
Example
import { useState } from "react";
import { View } from "react-native";
import { BottomSheet, Button, ListItem, useTheme } from "@stylhero/native";
function BottomSheetExample() {
const [open, setOpen] = useState(false);
const theme = useTheme();
return (
<>
<Button variant="secondary" onPress={() => setOpen(true)}>Sort</Button>
<BottomSheet visible={open} onClose={() => setOpen(false)} title="Sort by">
<View style={{ gap: theme.spacing[2] }}>
<ListItem title="Price, low to high" onPress={() => setOpen(false)} />
<ListItem title="Newest" onPress={() => setOpen(false)} />
</View>
</BottomSheet>
</>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children required |
ReactNode |
- | |
onClose required |
() => void |
- | Called on the backdrop, dragging the sheet down, the handle, Android back, and the iOS escape gesture. |
visible required |
boolean |
- | |
bottomInset |
number |
0 |
Extra space under the content, e.g. the bottom safe-area inset. |
closeLabel |
string |
"Close" |
Spoken name of the drag handle, which closes the sheet when activated. Default "Close". |
dismissable |
boolean |
true |
Set to false while closing would lose work; then only your own buttons close it. |
maxHeight |
DimensionValue |
"90%" |
|
testID |
string |
- | |
title |
string |
- |
Screen reader gestures
| Gesture (VoiceOver / TalkBack) | Does |
|---|---|
| Double-tap the handle | Closes the sheet (it's a "Close" button for screen reader users) |
Accessibility
- Screen readers stay inside it while it's open. Android back and the iOS escape gesture (two-finger Z) close it unless
dismissable={false}. - Sighted users can also drag it down or tap the backdrop.
- The slide is skipped when Reduce Motion is on.
Generated from src/components/BottomSheet.tsx. Something wrong or missing? Open an issue.