Skip to content
프로젝트

소개

Native-like swipeable sheets for React: bottom sheets, sidebars, dialogs, toasts, lightboxes and pages that swipe and snap like native ones. Unstyled, accessible, zero dependencies. Examples, issues and discussions.

웹 및 앱 개발

이 수치를 측정하는 방법

What you can do

  • Swipes that feel native: the swipe is built on CSS Scroll Snap, so the sheet has the device's real momentum and overscroll.
  • Spring animations at full frame rate: opening, stepping between detents and dismissing use spring physics (presets like "snappy" and "bouncy", or your own), run off the main thread.
  • Swipe gestures everywhere: touch, trackpad and mouse wheel, on mobile, tablet and desktop.
  • Detents (snap points): rest a sheet at one or more heights and step between them.

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+2
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Silk

Native-like swipeable sheets for React

Website · Documentation · Live examples · Pricing · npm

Silk is a React library to build bottom sheets, sidebars, dialogs, toasts, lightboxes and pages that swipe and snap like native ones. One Sheet component covers them all, with swipe gestures, detents (snap points), stacking and on-screen keyboard handling built in. Unstyled, accessible, zero dependencies.

It's also fast where most sheet libraries aren't. The swipe is the browser's own scrolling, and the spring animations run off the main thread too, so both keep your screen's full refresh rate (up to 120 fps, iOS Safari included) and stay smooth while your app is busy.

Used in production by OpenAI, Lovable, Mysten Labs, Owner.com, Tjek, BookRetreats and many others.

This repository holds Silk's public examples, its issue tracker and its discussions. The library itself is distributed on npm as @silk-hq/components.

Quick start

npm install @silk-hq/components

Import the styles once:

@import "@silk-hq/components/unlayered-styles.css";

Then build a bottom sheet:

import { Sheet } from "@silk-hq/components";

export function BottomSheet() {
  return (
    <Sheet.Root license="commercial">
      <Sheet.Trigger>Open</Sheet.Trigger>
      <Sheet.Portal>
        <Sheet.View detents="60lvh" nativeEdgeSwipePrevention={true}>
          <Sheet.Backdrop themeColorDimming="auto" />
          <Sheet.Content>
            <Sheet.BleedingBackground />
            <Sheet.Title>Title</Sheet.Title>
            <Sheet.Description>Description</Sheet.Description>
          </Sheet.Content>
        </Sheet.View>
      </Sheet.Portal>
    </Sheet.Root>
  );
}

See Getting started for the full setup, including Tailwind CSS v4.

Features

  • Swipes that feel native: the swipe is built on CSS Scroll Snap, so the sheet has the device's real momentum and overscroll.
  • Spring animations at full frame rate: opening, stepping between detents and dismissing use spring physics (presets like "snappy" and "bouncy", or your own), run off the main thread.
  • Swipe gestures everywhere: touch, trackpad and mouse wheel, on mobile, tablet and desktop.
  • Detents (snap points): rest a sheet at one or more heights and step between them.
  • Any placement: bottom, top, left, right or centered.
  • Scrollable content: a Scroll component made to work inside sheets.
  • On-screen keyboard handling: inputs stay visible, the page doesn't jump.
  • Stacked and nested sheets, with animations driven by the gesture.
  • Modal or non-modal: focus trapping, outside-interaction blocking and scroll locking, each configurable.
  • Accessible: WAI-ARIA roles, labels, focus management, Escape, reduced motion.
  • Gesture-driven effects: animate any CSS property of any element from the sheet's position, like scaling the page behind it or fading a backdrop.
  • Unstyled: works with CSS, CSS Modules, Tailwind CSS or CSS-in-JS.
  • TypeScript, with all types exported.
  • No dependencies other than React. Works with React 17, 18 and 19.

Examples

The examples/css directory is a Next.js app with 12 complete examples, ready to copy:

Example What it shows
BottomSheet A modal bottom sheet
SheetWithDetent A sheet with a detent (snap point) and a scrollable list
SheetWithKeyboard A form that works with the on-screen keyboard
SheetWithStacking Sheets opened from sheets, with a stacking animation
Sidebar A sidebar from the left edge
Toast A non-modal, swipeable notification
TopSheet A sheet from the top edge
DetachedSheet A floating sheet, detached from the screen's edges
Card A centered card
LongSheet A sheet taller than the screen
Page A full-screen page that slides in from the right and swipes back
PageFromBottom A full-screen page that slides up from the bottom

Try them in CodeSandbox, see them live on silkhq.com, or copy the directory:

npx degit silk-hq/silk/examples/css silk-examples-css

4 advanced examples (Sheet with Depth, Persistent Sheet with Detent, Lightbox, Parallax Page) come with the commercial license.

Documentation

License

Silk is free for non-commercial use. Commercial use requires a commercial license: a one-time payment, starting at €299, priced by your organization's size at purchase (buy a license), for unlimited projects within your organization, with free updates.

Silk is proprietary software: its source is not in this repository. See the terms.

Issues and discussions

관련 프로젝트 살펴보기

불러오는 중…