Code

<!-- glass-sheet.free.js: download it from the Install section below and host it with your site -->
<script src="/glass-sheet.free.js" defer></script>

<button id="invite">Invite a teammate</button>

<glass-sheet side="center" label="Invite a teammate" theme="light">
  <h2>Invite a teammate</h2>
  <p>They get access as soon as they accept.</p>
  <button data-sheet-close>Cancel</button>
</glass-sheet>

<script>
  const sheet = document.querySelector('glass-sheet');
  document.querySelector('#invite').addEventListener('click', () => sheet.show());
  sheet.addEventListener('close', () => console.log('closed'));
</script>

In context

A bottom sheet — drag the handle down to dismiss
A drawer from the right, Mint Pro

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.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/glass-sheet.json
2. Load it and use the element
HTML
<!-- glass-sheet.free.js: download it from the Install section below and host it with your site -->
<script src="/glass-sheet.free.js" defer></script>

<button id="invite">Invite a teammate</button>

<glass-sheet side="center" label="Invite a teammate" theme="light">
  <h2>Invite a teammate</h2>
  <p>They get access as soon as they accept.</p>
  <button data-sheet-close>Cancel</button>
</glass-sheet>

<script>
  const sheet = document.querySelector('glass-sheet');
  document.querySelector('#invite').addEventListener('click', () => sheet.show());
  sheet.addEventListener('close', () => console.log('closed'));
</script>
3. React + TypeScript (optional)

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:

TypeScript
// glass-sheet.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'glass-sheet': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      open?: boolean | '';
      side?: 'center' | 'bottom' | 'right' | 'left';
      width?: number | string;
      radius?: number | string;
      dismissible?: 'true' | 'false';
      'close-button'?: 'true' | 'false';
      contained?: boolean | '';
      label?: string;
      theme?: 'light' | 'dark';
      sound?: boolean | '';
    };
  }
}

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

NameTypeDefaultDescription
open booleanoffShows 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 width420 / 520 / 380Panel width (dialog / bottom sheet / drawer). It never exceeds the screen.
radius number (px)26Corner 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 booleanoffCovers 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 booleanoffA 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