Sheets
Usages
Sheets Variant Accordion
Sheets Variant Collapsible
Long ago, during the era of Gol D. Roger, the Pirate King, the seas were filled with tales of adventure, danger, and mystery. His final words before execution ignited the "Great Pirate Era": "My treasure? It's yours if you want it. I left everything I gathered in one place." These words inspired countless pirates, including a young boy named Monkey D. Luffy, who dreamed of finding the legendary One Piece and becoming the next Pirate King. With a straw hat gifted by the infamous Shanks and the power of the Gomu Gomu no Mi, a mysterious Devil Fruit, Luffy set out on a journey that would bring together an unforgettable crew and face unimaginable challenges. From battling fierce Warlords to uncovering secrets of the Void Century, their adventure is a testament to loyalty, courage, and the unbreakable bonds of friendship.
Sheets Variant Dialog
Dialog Nested
Sheets Variant Drawer
Drawer Nested
Sheets Variant Dropdown
Side offset
Dropdown Nested
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 |
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 |
setOpenId? | (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 |