Skip to content

Sheet

A panel that slides in from the edge of the screen, for filters, navigation or details. Same markup and props in every style: switch the style in the header to see it change.

Basic

Filters from the right, with the actions pinned to the bottom.

Filters

Narrow the list of components.

sheet-basic.html
<button type="button" class="vin-btn vin-btn--outline" commandfor="sheet-filters" command="show-modal">Filters</button>
<dialog class="vin-dialog vin-sheet" id="sheet-filters" aria-labelledby="sheet-filters-title" aria-describedby="sheet-filters-desc" closedby="any">
  <div class="vin-dialog__header">
    <h2 class="vin-dialog__title" id="sheet-filters-title">Filters</h2>
    <p class="vin-dialog__description" id="sheet-filters-desc">Narrow the list of components.</p>
  </div>
  <form method="dialog">
    <div class="vin-dialog__body">
      <div class="vin-field">
        <label class="vin-label" for="sheet-q">Search</label>
        <input id="sheet-q" class="vin-input" type="search" placeholder="Button, card…">
      </div>
      <div class="vin-choice">
        <input id="sheet-forms" class="vin-checkbox" type="checkbox" checked>
        <div class="vin-choice__body">
          <label class="vin-choice__label" for="sheet-forms">Forms</label>
        </div>
      </div>
      <div class="vin-choice">
        <input id="sheet-overlays" class="vin-checkbox" type="checkbox">
        <div class="vin-choice__body">
          <label class="vin-choice__label" for="sheet-overlays">Overlays</label>
        </div>
      </div>
    </div>
    <div class="vin-dialog__footer">
      <button type="button" class="vin-btn vin-btn--outline" commandfor="sheet-filters" command="close">Cancel</button>
      <button type="submit" class="vin-btn" value="apply">Show results</button>
    </div>
  </form>
  <button type="button" class="vin-btn vin-btn--ghost vin-btn--icon vin-dialog__close" commandfor="sheet-filters" command="close" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
</dialog>

Navigation

Site links from the left, as a mobile menu.

sheet-left.html
<button type="button" class="vin-btn vin-btn--outline" commandfor="sheet-nav" command="show-modal">Menu</button>
<dialog class="vin-dialog vin-sheet" id="sheet-nav" data-side="left" aria-labelledby="sheet-nav-title" closedby="any">
  <div class="vin-dialog__header">
    <h2 class="vin-dialog__title" id="sheet-nav-title">VinUI</h2>
  </div>
  <div class="vin-dialog__body">
    <nav aria-label="Main" style="display: grid; gap: 12px">
      <a class="vin-link" href="#docs">Docs</a>
      <a class="vin-link" href="#components">Components</a>
      <a class="vin-link" href="#styles">Styles</a>
      <a class="vin-link" href="#changelog">Changelog</a>
    </nav>
  </div>
  <button type="button" class="vin-btn vin-btn--ghost vin-btn--icon vin-dialog__close" commandfor="sheet-nav" command="close" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
</dialog>

From the bottom

A short panel that comes up from the bottom edge.

Share this page

Anyone with the link can view it.

sheet-bottom.html
<button type="button" class="vin-btn vin-btn--outline" commandfor="sheet-share" command="show-modal">Share</button>
<dialog class="vin-dialog vin-sheet" id="sheet-share" data-side="bottom" aria-labelledby="sheet-share-title" aria-describedby="sheet-share-desc" closedby="any">
  <div class="vin-dialog__header">
    <h2 class="vin-dialog__title" id="sheet-share-title">Share this page</h2>
    <p class="vin-dialog__description" id="sheet-share-desc">Anyone with the link can view it.</p>
  </div>
  <div class="vin-dialog__body">
    <div class="vin-field">
      <label class="vin-label" for="sheet-link">Link</label>
      <input id="sheet-link" class="vin-input" value="https://vinish.dev/ui" readonly>
    </div>
  </div>
  <button type="button" class="vin-btn vin-btn--ghost vin-btn--icon vin-dialog__close" commandfor="sheet-share" command="close" aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
</dialog>

Installation

React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:

Terminal
npx @vinish/ui add sheet
React
import { Sheet, SheetClose } from "@/components/vin/sheet";
Vue
import Sheet, { SheetClose } from "@/components/vin/sheet.vue";
Svelte
import Sheet from "$lib/components/vin/sheet.svelte";

The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.

Plain HTML: the classes come with the style's stylesheet. It needs no JavaScript.

API

From spec/sheet.json, which every framework version is tested against.

PropValuesDefaultIn HTML
siderightlefttopbottomrightdata-side on the dialog
trigger / title / description / footer
The same as Dialog.
boolean—the Dialog parts inside dialog.vin-dialog.vin-sheet
open / defaultOpen
Use onOpenChange to hear about changes.
boolean——
onSubmit
Wraps the body and footer in a form.
(data: FormData) => void—form[method=dialog]

Parts

React, Vue, SvelteHTML classes
<Sheet><SheetClose>.vin-sheet

Accessibility

  • It's a modal <dialog>, so it works like Dialog: focus stays inside, Escape closes it, focus goes back to the trigger.
  • A click on the dimmed page closes it.
  • In right-to-left pages the right sheet comes from the left, and the other way round.
  • With reduced motion, it fades in instead of sliding.