Lunar Kit LogoLunar Kit
Components

Bottom Sheet

A panel that slides up from the bottom of the screen, commonly used for selections, menus, or additional content.

Demo
Code
Open Sheet

Installation

lunar add bottom-sheet

Usage

import {
BottomSheet,
BottomSheetTrigger,
BottomSheetContent,
BottomSheetHeader,
BottomSheetTitle,
BottomSheetBody,
BottomSheetFooter,
BottomSheetClose,
BottomSheetList,
BottomSheetDragArea,
} from '@/components/ui/bottom-sheet';

Basic Usage

<BottomSheet>
<BottomSheetTrigger>
  <Button>Open Sheet</Button>
</BottomSheetTrigger>
 
<BottomSheetContent>
  <BottomSheetHeader>
    <BottomSheetTitle>Sheet Title</BottomSheetTitle>
  </BottomSheetHeader>
  
  <BottomSheetBody>
    <Text>Your content goes here.</Text>
  </BottomSheetBody>
  
  <BottomSheetFooter>
    <BottomSheetClose>
      <Button>Close</Button>
    </BottomSheetClose>
  </BottomSheetFooter>
</BottomSheetContent>
</BottomSheet>

Controlled State

const [open, setOpen] = useState(false);
 
<BottomSheet open={open} onOpenChange={setOpen}>
<BottomSheetTrigger>
  <Button>Open Sheet</Button>
</BottomSheetTrigger>
 
<BottomSheetContent>
  <BottomSheetHeader>
    <BottomSheetTitle>Controlled Sheet</BottomSheetTitle>
  </BottomSheetHeader>
  
  <BottomSheetBody>
    <Text>This sheet's state is controlled externally.</Text>
    <Button onPress={() => setOpen(false)}>Close</Button>
  </BottomSheetBody>
</BottomSheetContent>
</BottomSheet>

Snap Points

Define multiple snap points for the sheet:

<BottomSheet snapPoints={['25%', '50%', '90%']}>
<BottomSheetTrigger>
  <Button>Open Sheet</Button>
</BottomSheetTrigger>
 
<BottomSheetContent>
  <BottomSheetHeader>
    <BottomSheetTitle>Resizable Sheet</BottomSheetTitle>
  </BottomSheetHeader>
  
  <BottomSheetBody>
    <Text>Drag to resize between snap points.</Text>
  </BottomSheetBody>
</BottomSheetContent>
</BottomSheet>

Variants

// Default
<BottomSheet variant="default">
{/* ... */}
</BottomSheet>
 
// Filled
<BottomSheet variant="filled">
{/* ... */}
</BottomSheet>

With List

Display a selectable list:

const options = [
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: '2' },
{ label: 'Option 3', value: '3' },
];
 
<BottomSheet>
<BottomSheetTrigger>
  <Button>Select Option</Button>
</BottomSheetTrigger>
 
<BottomSheetContent>
  <BottomSheetHeader>
    <BottomSheetTitle>Choose an Option</BottomSheetTitle>
  </BottomSheetHeader>
  
  <BottomSheetList
    data={options}
    variant="select"
    selectedValue={selected}
    onSelect={(item) => setSelected(item.value)}
    getItemValue={(item) => item.value}
  />
</BottomSheetContent>
</BottomSheet>

Multiple Selection List

<BottomSheetList
data={options}
variant="multiple"
selectedValues={selectedValues}
onSelect={(items) => setSelectedValues(items.map(i => i.value))}
getItemValue={(item) => item.value}
/>

Scrollable Content

<BottomSheet snapPoints={['70%']}>
<BottomSheetTrigger>
  <Button>Open Sheet</Button>
</BottomSheetTrigger>
 
<BottomSheetContent>
  <BottomSheetHeader>
    <BottomSheetTitle>Long Content</BottomSheetTitle>
  </BottomSheetHeader>
  
  <BottomSheetBody scrollable>
    {/* Long scrollable content */}
    {items.map((item) => (
      <View key={item.id} className="py-4 border-b border-border">
        <Text>{item.name}</Text>
      </View>
    ))}
  </BottomSheetBody>
</BottomSheetContent>
</BottomSheet>

API Reference

BottomSheet

Root component.

PropTypeDefaultDescription
openbooleanControlled open state
onOpenChange(open: boolean) => voidCallback when state changes
snapPointsstring[]['50%']Height snap points
defaultSnapPointnumber0Initial snap point index
variant'default' | 'filled''default'Visual variant

BottomSheetTrigger

Button that opens the sheet.

PropTypeDefaultDescription
childrenReactNodeRequiredTrigger element

BottomSheetContent

Content container.

PropTypeDefaultDescription
childrenReactNodeRequiredSheet content
classNamestringAdditional classes

BottomSheetHeader

Header section.

PropTypeDefaultDescription
childrenReactNodeRequiredHeader content
classNamestringAdditional classes

BottomSheetTitle

Title text.

PropTypeDefaultDescription
childrenReactNodeRequiredTitle text
classNamestringAdditional classes

BottomSheetBody

Main content area.

PropTypeDefaultDescription
childrenReactNodeRequiredBody content
scrollablebooleanfalseEnable scrolling
classNamestringAdditional classes

BottomSheetFooter

Footer section.

PropTypeDefaultDescription
childrenReactNodeRequiredFooter content
classNamestringAdditional classes

BottomSheetClose

Closes the sheet when pressed.

PropTypeDefaultDescription
childrenReactNodeRequiredClose trigger

BottomSheetList

Selectable list component.

PropTypeDefaultDescription
dataT[]RequiredList data
variant'list' | 'select' | 'multiple''list'List type
selectedValueanySelected value (select)
selectedValuesany[]Selected values (multiple)
onSelect(selected) => voidSelection callback
getItemValue(item) => anyValue extractor
renderItemListRenderItemCustom render function
keyExtractor(item, index) => stringKey extractor

BottomSheetDragArea

An area that can be dragged to move or close the bottom sheet.

PropTypeDefaultDescription
childrenReactNodeOptional custom handle content
classNamestringAdditional classes