Sheets
A utility set for building modal dialogs, dropdowns, drawers, collapsibles, and accordions, with support for nested interactions.
Sheets
is a flexible and composable UI abstraction that unifies multiple interaction patterns — including Accordion, Collapsible, Dialog, Drawer, and Dropdown — into a single, consistent system.
Designed to simplify complex layouts and improve development efficiency, Sheets
enables you to manage visibility, transitions, and nested structures seamlessly across different UI contexts.
It offers variants suited for various use cases, such as content organization (Accordion), simple toggling (Collapsible), modal workflows (Dialog), off-canvas navigation (Drawer), and compact selection lists (Dropdown).
With Sheets
, you can build modular, accessible, and highly customizable user experiences with minimal boilerplate.
Usages
Various examples of Sheets
Implementation for various component patterns.
Sheets
offers a high moment to create interactive components that can be developed as needed.
Sheets Variant Accordion
Display collapsible content organized into accordion-style sections. This variant allows expanding one section at a time for a clean and structured user experience.
Sheets Variant Collapsible
Simple collapsible component for toggling the visibility of content. Useful for hiding and revealing sections without restricting to only one open at a time.
Sheets Variant Dialog
Modal dialog component for user interactions requiring focus. Dialogs are commonly used for confirmation prompts, forms, or important notices.
Dialog Nested
Example of nesting dialogs within dialogs. Useful when complex workflows require multiple layers of modal interactions.
Sheets Variant Drawer
Slide-in panel component typically used for sidebars, menus, or additional contextual content. Drawers provide an off-canvas UI that is accessible and intuitive.
Drawer Nested
Example of nesting drawers inside drawers. Helpful for creating multi-level navigation structures or deep contextual workflows.
Sheets Variant Dropdown
Dropdown menu component for showing a list of actions or links. Dropdowns are compact, context-sensitive components for user choices.
Dropdown Nested
Example of nesting dropdowns within other dropdowns. Ideal for building multi-level menu structures or advanced option trees.
Depend on
Animation
The accordion
and collapsible
variant components use keyframe animation which by default is set using the tailwindcss class.
Add the following animation
to your tailwind.config.js
file:
import { PluginAPI, type Config } from "tailwindcss/types/config";
import plugin from "tailwindcss/plugin";
export default {
theme: {
extend: {
animation: {
"collapse-open": "collapse-open 0.2s linear forwards",
"collapse-closed": "collapse-closed 0.2s linear forwards"
},
keyframes: {
"collapse-open": {
from: { height: "0", opacity: "0" },
to: { height: "var(--measure-available-h)" }
},
"collapse-closed": {
from: { height: "var(--measure-available-h)" },
"85%": { opacity: "0" },
to: { height: "0", visibility: "hidden" }
}
}
}
},
plugins: [
require("tailwindcss-animate"),
plugin(({ addBase, addUtilities }: PluginAPI) => {
addBase({});
addUtilities({});
})
]
} satisfies Config;
API References
Props API
Props API | Type | Default | Annotation |
---|---|---|---|
variant? | SheetsVariant | "accordion" | "dialog" | "accordion" | "collapsible" | "dropdown" | "drawer" |
align? | "center" | "start" | "end" | "center" | only available on "dropdown" variant |
side? | "top" | "right" | "bottom" | "left" | "bottom" | only available on ["dropdown", "drawer"] variant |
open? | boolean | false | change the original open and onOpenChange state with own approach |
onOpenChange? | (value: boolean) => void | openState | change the original open and onOpenChange state with own approach |
sideOffset? | number | stroke | distance between trigger and content , only available on "dropdown" variant |
aligneOffset? | number | stroke | distance between trigger and content , only available on "dropdown" variant |
clickOutsideToClose? | boolean | false | open=false when click outside content |
defaultOpen? | boolean | string | null | false | null | change initial open=true , in case "accordion" variant is string | null |
openId? | string | null | undefined | used when you want to modify the open state based on key | id |
onOpenChangeId? | (value: string | null) => void | undefined | used when you want to modify the open state based on key | id |
delay? | open?: number; closed?: number | 0 | on development |
multipleOpen? | boolean | false | only available on "accordion" variant |
hotKeys? | (string & {}) | "" | only available on ["dialog", "drawer"] variant |
modal? | boolean | true on ["dialog", "drawer"] variant | hide scrollbar body when open=true |
popstate? | boolean | false | added history.pushState() when open=true and history.back() when open=false |
Source Codes
Full working code example, including necessary markup and styles. You can copy and paste this code directly to start using the component immediately.