Panels and menusInteractive playground
Sheet
A side panel for tasks that need context.
Preparing the playground…
Text and Markdown example
Sheet · Example
1<Sheet><SheetTrigger asChild><Button>Open panel</Button></SheetTrigger><SheetContent><SheetHeader><SheetTitle>A space for your idea</SheetTitle><SheetDescription>Review the details before continuing.</SheetDescription></SheetHeader><div style={{padding:"24px 0"}}><Input aria-label="Project name" placeholder="Project name" /></div><SheetFooter><SheetClose asChild><Button>Done</Button></SheetClose></SheetFooter></SheetContent></Sheet>How to use it
Always include Title and Description. The trigger opens the panel, Escape closes it and focus returns to the original control. You can manage open and onOpenChange.
Import
React / Next.js
1import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, SheetFooter, SheetClose, SheetOverlay, SheetPortal } from "@kivora/nextjs";Interactive examples run inside a component with "use client". The playground's Copy button includes the imports needed for the current example.
API reference 0.2.0
Types from the installed published version, including component properties and common HTML attributes. “Optional” does not imply a default value; omitting a property lets the component decide.
| Property | Type | Description |
|---|---|---|
children | ReactNode | Content or child elements of the component. |
defaultOpen | boolean | Whether it starts open in uncontrolled mode. |
modal | boolean | Configures modal. The type describes the supported values and structure. |
onOpenChange | ((open: boolean) => void) | Receives the new open state. |
open | boolean | Controlled open state. |
Subcomponents and composition
Review each component's properties and published declaration. Native and accessibility attributes are inherited from the element specified by its type.
Sheet5 properties
Sheet · TypeScript
1declare function Sheet({ open, defaultOpen, onOpenChange, ...props }: SheetProps): React.JSX.Element;SheetTrigger18 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
disabled | boolean | Disable interaction with the control. |
id | string | Element identifier; associates labels and descriptions. |
name | string | Name used to identify the control in forms. |
onChange | ChangeEventHandler<HTMLButtonElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLButtonElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLButtonElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
type | "button" | "submit" | "reset" | Operation type or mode; values depend on the component. |
value | string | number | readonly string[] | Controlled value. Update it from the change callback. |
SheetTrigger · TypeScript
1SheetTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>SheetContent25 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
closeLabel | string | Configures closeLabel. The type describes the supported values and structure. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
deferPointerDownOutside | boolean | When `true`, a `'pointerdown'` event outside of the layered element will wait for the interaction's click event before dispatching, allowing third-party code to stop propagation of later events and cancel dismissal. |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onCloseAutoFocus | ((event: Event) => void) | Event handler called when auto-focusing on close. Can be prevented. |
onEscapeKeyDown | ((event: KeyboardEvent) => void) | Event handler called when the escape key is down. Can be prevented. |
onFocusOutside | ((event: FocusOutsideEvent) => void) | Event handler called when the focus moves outside of the `DismissableLayer`. Can be prevented. |
onInteractOutside | ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void) | Event handler called when an interaction happens outside the `DismissableLayer`. Specifically, when a `pointerdown` event happens outside or focus moves outside of it. Can be prevented. |
onOpenAutoFocus | ((event: Event) => void) | Event handler called when auto-focusing on open. Can be prevented. |
onPointerDownOutside | ((event: PointerDownOutsideEvent) => void) | Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. Can be prevented. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
portalContainer | HTMLElement | null | Configures portalContainer. The type describes the supported values and structure. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
side | "left" | "right" | "top" | "bottom" | Side from which the panel appears. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
SheetContent · TypeScript
1SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.RefAttributes<HTMLDivElement>>SheetHeader13 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
SheetHeader · TypeScript
1SheetHeader: {
2 ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
3 displayName: string;
4}SheetTitle14 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLHeadingElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLHeadingElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLHeadingElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
SheetTitle · TypeScript
1SheetTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>SheetDescription14 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLParagraphElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLParagraphElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLParagraphElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
SheetDescription · TypeScript
1SheetDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>SheetFooter13 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
SheetFooter · TypeScript
1SheetFooter: {
2 ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
3 displayName: string;
4}SheetClose18 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
disabled | boolean | Disable interaction with the control. |
id | string | Element identifier; associates labels and descriptions. |
name | string | Name used to identify the control in forms. |
onChange | ChangeEventHandler<HTMLButtonElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLButtonElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLButtonElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
type | "button" | "submit" | "reset" | Operation type or mode; values depend on the component. |
value | string | number | readonly string[] | Controlled value. Update it from the change callback. |
SheetClose · TypeScript
1SheetClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>SheetOverlay15 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
SheetOverlay · TypeScript
1SheetOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>SheetPortal3 properties
| Property | Type | Description |
|---|---|---|
children | ReactNode | Content or child elements of the component. |
container | Element | DocumentFragment | null | Specify a container element to portal the content into. |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. |
SheetPortal · TypeScript
1SheetPortal: React.FC<DialogPrimitive.DialogPortalProps>API generated from @kivora/nextjs 0.2.0View package