StartFoundationsComponentsContent

Sheet

A sheet is a modal panel that slides in from an edge of the screen. It is also called a drawer or side panel.

Stable Figma
OverviewUsageAPIAccessibility
Show filters Unread Starred Clear Apply
<tk-button onclick="document.getElementById('sheet').show()">Show filters</tk-button>
<tk-sheet id="sheet" heading="Filters" side="right">
  <tk-checkbox>Unread</tk-checkbox>
  <tk-checkbox>Starred</tk-checkbox>
  <tk-button slot="footer" onclick="this.closest('tk-sheet').close()">Clear</tk-button>
  <tk-button slot="footer" variant="primary" onclick="this.closest('tk-sheet').close()">Apply</tk-button>
</tk-sheet>

Anatomy

Part What it is
heading heading: the title and accessible name, required
close button built in, top right
body the default slot; it scrolls
footer the footer slot: your buttons, right-aligned; hidden when empty
backdrop dims the page and blocks it
dialog part the panel

Sides

<tk-button onclick="document.getElementById('filters').show()">Show filters</tk-button>
<tk-sheet id="filters" heading="Filters" side="right">
  <tk-checkbox>Unread</tk-checkbox>
  <tk-checkbox>Starred</tk-checkbox>
  <tk-button slot="footer" onclick="this.closest('tk-sheet').close()">Clear</tk-button>
  <tk-button slot="footer" variant="primary" onclick="this.closest('tk-sheet').close()">Apply</tk-button>
</tk-sheet>
side Shape
right (default) full height, 440px wide
left full height, 440px wide
top full width, as tall as its content
bottom full width, as tall as its content
  • The panel slides in from its side and back out when it closes.
  • A side sheet narrows to fit the viewport with space-16 (16px) to spare. A top or bottom sheet grows up to the viewport height minus 16px, then its body scrolls.
  • To change a side sheet's width, set --tk-sheet-size. There is no size attribute.
  • Long content scrolls in the body while the heading and footer stay put. The content fades at an edge while there's more beyond it.

Opening and closing

<tk-button onclick="document.getElementById('details').show()">View details</tk-button>
<tk-sheet id="details" heading="Order 1024" side="right">
  <p>Shipped on 12 March to Ada Lovelace, London.</p>
</tk-sheet>
  • show() opens the sheet, always as a modal. close(value) closes it, and returnValue holds the value in your close listener. Focus goes back to the element that opened it.
  • A sheet closes the same ways as a Dialog: Esc, the close button, a backdrop click, or your buttons. Closing never saves anything.
  • A sheet that holds a <form> doesn't close on a backdrop click, so a stray click can't lose the work. Esc and the close button still close it.
  • To ask before losing unsaved changes, listen for cancel: Esc and a backdrop click fire it first, and preventDefault() keeps the sheet open. Then open a "Discard changes?" confirm dialog over the sheet.
  • persistent turns off Esc and the backdrop. The close button and your buttons still work. Keep it for a task people must finish.