Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-modal-sheet

> 前端框架
Open source

Flexible bottom sheet component built with Motion to provide buttery smooth UX while keeping accessibility in mind

1.2K stars0 likes1 views
WebsiteGitHub

About

Flexible bottom sheet component built with Motion to provide buttery smooth UX while keeping accessibility in mind

Installation

bash
npm install react-modal-sheet

Peer dependencies

The gestures and animations are handled by the excellent Motion library so before you can start using this library you need to install motion:

bash
npm install motion

Table of contents

  • Usage
  • Props
  • Methods and properties
  • Detents
  • Compound Components
  • Advanced behavior
  • Customization
  • Accessibility
  • Troubleshooting

Usage

typescript
import { Sheet } from 'react-modal-sheet';
import { useState } from 'react';

function Example() {
  const [isOpen, setOpen] = useState(false);

  return (
    <>
       setOpen(true)}>Open sheet

       setOpen(false)}>
        
          
          {/* Your sheet content goes here */}
        
        
      
    
  );
}

The Sheet component follows the Compound Component pattern in order to provide a flexible yet powerful API for creating highly customizable bottom sheet components.

Since the final bottom sheet is composed from smaller building blocks (Container, Content, Header, and Backdrop) you are in total control over the rendering output. So for example, if you don't want to have any backdrop in your sheet then you can just skip rendering it instead of passing some prop like renderBackdrop={false} to the main sheet component. Cool huh?

Also, by constructing the sheet from smaller pieces makes it easier to apply any necessary accessibility related properties to the right components without requiring the main sheet component to be aware of them. You can read more about accessibility in the Accessibility section below.

️ Props

Name Required Default Description
children yes Use Sheet.Container/Content/Header/Backdrop to compose your bottom sheet.
isOpen yes Boolean that indicates whether the sheet is open or not.
onClose yes Callback fn that is called when the sheet is closed by the user.
avoidKeyboard no true Automatically avoid the virtual keyboard by adding bottom padding when the keyboard is open. Only works on mobile devices with Virtual Keyboard or Visual Viewport API support.
disableDrag no false Disable drag for the whole sheet.
disableDismiss no false Disable dismissing the sheet via dragging or high velocity swipe. When enabled, the sheet can only be closed programmatically.
disableScrollLocking no false Disable scroll locking for the body element while sheet is open. Can be useful if you face issues with input elements and the iOS virtual keyboard. See related issue.
detent no 'default' The detent in which the sheet should be in when opened. Available values: 'default', 'content', or 'full'.
onOpenStart no Callback fn that is called when the sheet opening animation starts.
onOpenEnd no Callback fn that is called when the sheet opening animation is completed.
onCloseStart no Callback fn that is called when the sheet closing animation starts.
onCloseEnd no Callback fn that is called when the sheet closing animation is completed.
onSnap no Callback fn that is called with the current snap point index when the sheet snaps to a new snap point. Requires snapPoints prop.
snapPoints no Eg. [0, 0.5, 100, 1] - where positive values are pixels from the bottom of the sheet and negative from the top. Values between 0-1 represent percentages, eg. 0.5 means 50% of sheet height. Must be in ascending order and should include 0 (closed) and 1 (fully open).
initialSnap no 0 Initial snap point when sheet is opened (index from snapPoints).
modalEffectRootId no The id of the element where the main app is mounted, eg. "root". Enables iOS modal effect.
modalEffectThreshold no 0 Threshold value between 0-1 which determines when the iOS modal effect will start while dragging the sheet - 0 corresponding to the start of the drag (0% has been dragged into view) and 1 corresponding to the end of the drag (100% of the sheet is visible).
tweenConfig no { ease: 'easeOut', duration: 0.2 } Overrides the config for the sheet tween transition when the sheet is opened, closed, or snapped to a point.
mountPoint no document.body HTML element that should be used as the mount point for the sheet.
prefersReducedMotion no false Skip sheet animations (sheet instantly snaps to desired location).
dragVelocityThreshold no 500 How fast the sheet must be flicked down to close. Higher values make the sheet harder to close.
dragCloseThreshold no 0.6 The portion of the sheet which must be dragged off-screen before it will close.
unstyled no false Remove all decorative styles and only apply base functional styles. Useful when you want to completely customize the sheet appearance.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptaccessibilitybottom-sheetframer-motionmodal

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架