Code
In context
Install · Free Web Component
One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.
The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:
Pro · React + TypeScript Pro
One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.
- React component (
open/onClose) with TypeScript types and the full source - Sunset, Mint and Mono tints, plus custom tints from Brand Fit
- The vanilla Web Component with every tint, a demo page, README and license
Attributes & props
| Name | Type | Default | Description |
|---|---|---|---|
| open | boolean | off | Shows the sheet. Also el.show() and el.hide(). When the user dismisses it, the attribute is removed and close fires. |
| side | 'center' | 'bottom' | 'right' | 'left' | 'center' | A centred dialog, a bottom sheet you can drag down to dismiss, or a drawer. |
| width | number (px) | CSS width | 420 / 520 / 380 | Panel width (dialog / bottom sheet / drawer). It never exceeds the screen. |
| radius | number (px) | 26 | Corner radius of the panel. |
| dismissible | 'true' | 'false' | 'true' | Whether Escape, a click on the backdrop and a drag close it. Set false for a step the user must answer. |
| close-button | 'true' | 'false' | 'true' | The × in the corner. |
| data-sheet-close | attribute on a child | — | Any element inside with this attribute closes the sheet when clicked — your own Cancel or Done button. |
| contained | boolean | off | Covers the nearest positioned parent instead of the whole viewport, and leaves page scroll alone. |
| label | string | — | Accessible name of the dialog, read by screen readers when it opens. |
| theme | 'light' | 'dark' | 'light' | White or dark glass. |
| sound | boolean | off | A glass clink on open and close. Also on for everything inside an element with data-ui-sound="on". |
| tint Pro | 'aurora' | 'sunset' | 'mint' | 'mono' | object | 'aurora' | Colours of the light along the top edge, or a custom tint. Free build ships Aurora only. |
While it is open, focus moves into the sheet and Tab stays inside it; closing gives focus back to whatever opened it. The page behind stops scrolling. It is a role="dialog" with aria-modal, so give it a label. Put it near the end of <body>: an ancestor with a CSS transform or filter would make it cover that ancestor instead of the screen. The backdrop blur is the expensive part — on very old phones you can lower it with --gs-veil and plain CSS.
More components
- Glass Toast
- Glass Tip
- Glass Menu
- Tide Slide
- Pearl Code
- Ink Sphere
- Frost Card
- Holo Card
- Stream Text
- Lens Compare
- Pearl Dial
- Nova Rating
- Pearl Check
- Pearl Input
- Pearl Select
- Pearl Accordion
- Pearl Calendar
- Glass Nav
- Pearl Tabs
- Glass Command
- Halo Avatar
- Pearl Steps
- Pearl Skeleton
- Pearl Table
- Pearl Chip
- Pearl Empty
- Roll Counter
- Glass Marquee
- Reveal Text
- Mesh Gradient
- Silk Waves
- Dot Field
- Plasma Orb
- Voice Wave
- Plush Buddy
- Gummy Agent
- Glass Tabbar
- Pearl Pricing
- Glass Bento
- Quote Wall
- Glass Cta
- Magnet Button
- Beam Border
- Spotlight Card
- Scratch Reveal
- Glass Sidebar
- Pearl Pagination
- Pearl Breadcrumb
- Glass Dock
- Pearl Slider
- Pearl Segmented
- Liquid Metal Button
- Mercury Orb
- Prompt Input
- Voice Orb
- Aurora Ring
- Glass Toggle
- Firefly Button
- Pearl Button
- Pearl Loader
- Alien Face
- Prism Button
- Liquid Carousel
- Orbit Carousel
- Deck Carousel