Usage
<Sheet>
is used to display content that complements the main content of the screen. It slides out from the edge of the viewport.
Controlled state
To control the sheet’s visibility manually, set open
and onOpenChange
.
Position
You can control which side the sheet appears from using the side
prop on SheetContent
.
Custom close button
The <SheetHeader>
component includes a default close button. You can create a custom close button using <SheetClose>
.
API Reference
Sheet
The root component that contains all parts of a sheet.
Prop | Type | Default |
---|---|---|
defaultOpen | boolean | |
modal | boolean | true |
onOpenChange | (open: boolean) => void | |
open | boolean |
SheetTrigger
The button that opens the sheet when clicked.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
SheetContent
The component that contains the sheet’s content.
Inherits properties from HTMLDivElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
forceMount | boolean | |
onCloseAutoFocus | (event: Event) => void | |
onEscapeKeyDown | (event: KeyboardEvent) => void | |
onInteractOutside | (event: React.FocusEvent | MouseEvent | TouchEvent) => void | |
onOpenAutoFocus | (event: Event) => void | |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void | |
side | "top" "right" "bottom" "left" | "right" |
SheetHeader
A container for the sheet’s header content.
Inherits properties from HTMLDivElement
.
SheetTitle
An accessible title to be announced when the dialog is opened.
Inherits properties from HTMLHeadingElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
SheetDescription
An optional accessible description to be announced when the dialog is opened. Hide it by passing className="sr-only"
.
Inherits properties from HTMLParagraphElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
SheetBody
A container for the main content of the sheet.
Inherits properties from HTMLDivElement
.
SheetFooter
A container for the sheet’s footer content.
Inherits properties from HTMLDivElement
.
SheetClose
A button that closes the sheet when clicked.
Inherits properties from HTMLButtonElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |