npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@k4k3ru/design-system-side-sheet

v1.1.0

Published

Token-based native modal side sheet

Readme

Side Sheet

A dependency-free modal side sheet using native <dialog>. Inspired by Material side sheets and shadcn Sheet, with existing design system tokens taking precedence. This initial package implements the modal variant.

<button type="button" data-side-sheet-target="edit">Open</button>
<dialog data-side-sheet-id="edit" class="side-sheet" data-side="right" aria-labelledby="edit-title">
  <header class="side-sheet__header">
    <h2 id="edit-title" class="side-sheet__title">Edit</h2>
    <button type="button" data-side-sheet-close>Close</button>
  </header>
  <div class="side-sheet__body">Form or supporting content</div>
  <footer class="side-sheet__footer">Actions</footer>
</dialog>
import '@k4k3ru/design-system-side-sheet/auto';
import '@k4k3ru/design-system-side-sheet/style.css';

data-side-sheet-target is reserved for opening controls; its value must match exactly one dialog's data-side-sheet-id. The dialog itself needs no HTML id for JS routing. Keep heading IDs for aria-labelledby accessibility relationships. Empty, missing, duplicated or non-dialog targets are ignored. Values are matched literally, not parsed as CSS selectors. Native disabled and aria-disabled="true" controls are ignored. Use type="button" on triggers inside forms.

The /auto entry installs one delegated document listener and handles markup added later. Nested icons/labels also trigger their closest opening control. For explicitly scoped setup, use bindSideSheets(root) from the main entry; its return value removes the listener. Repeated binding to the same root does not add duplicate listeners.

getSideSheet(dialog) retrieves the shared controller for imperative lifecycle operations such as forced closing on session expiry. Existing new SideSheet(dialog) usage remains supported and reuses the same instance. Pages do not need to create controllers or wire click handlers just to open sheets.

side-sheet:beforeopen is cancelable and provides event.detail.opener; use it to prepare a form or reject opening during a write. side-sheet:open fires after opening.

Use data-side="left" or right (default). Header/footer stay visible while the body scrolls. Below 600px the sheet fills the viewport. Native dialog provides an inert background, modal focus containment and focus restoration. Escape, close controls and backdrop clicks use the same slide/fade exit. Reduced motion skips animation. Background scrolling is locked while open; destroy() restores it and removes listeners. Provide an accessible title, explicit close control and initial focus.

Override --side-sheet-width, --side-sheet-padding, --side-sheet-background, --side-sheet-color, --side-sheet-outline, --side-sheet-radius, --side-sheet-duration, --side-sheet-easing, or --side-sheet-scrim on the element. Motion, color and radius default to existing tokens.

side-sheet:beforeclose is cancelable, with event.detail.reason (escape, backdrop, button, programmatic, destroy). Consumers can prevent dismissal while saving. side-sheet:close fires after dismissal for sensitive-data cleanup. Use close('programmatic', { immediate: true, force: true }) for session expiry; destroy() also forcibly closes. Use this controller instead of calling the native close() when exit animation or dismissal guards are needed.

Build: npm run build. Example: serve the repository and open web/components/side_sheet/example/. No framework or third-party UI package is required.

Smaller size

Use side-sheet--smaller on the component root. Padding: 1.5rem to 1rem; width unchanged.

See shared sizing guidance and examples.