Lynx UI logo
Lynx UI

<Sheet>

A directional Sheet component for ReactLynx. It supports bottom-sheet and side-drawer semantics with drag interactions and snap point primitives.
  • Supports controlled and uncontrolled visibility.
  • Supports snap points, including percentages and content-driven height.
  • Supports imperative control through SheetRootRef.
Info

You can check the source code to understand how it works, and you're welcome to submit MRs to enhance its capabilities.

Sheet is a sliding surface for contextual actions, detail panels, and transient workflows. It supports bottom sheets, top sheets, side drawers, snap points, dragging, backdrop dismissal, and both controlled and imperative usage.

Basic Usage

Start with SheetRoot, SheetView, SheetBackdrop, and SheetContent. Put the visual surface on SheetContent, then use the backdrop and drag gestures for natural dismissal.

Auto Height

Use the fit snap point when the panel height should follow its content. This works well for menus, short forms, and content whose height is not known ahead of time.

Controlled

Use show with onShowChange when the open state belongs to the page. This is the right model when other UI, analytics, or navigation logic must stay in sync with the sheet.

Side

Use side to choose whether Sheet behaves like a bottom panel, top panel, or drawer. Prefer start and end for layouts that should follow RTL, and left or right when the physical edge must stay fixed.

Imperative

Use SheetRootRef when a parent needs to command the sheet directly. Methods such as open, close, snapTo, expand, and collapse are useful for toolbar actions and coordinated multi-step flows.

Structure

<SheetRoot>
  <SheetView>
    <SheetBackdrop />
    <SheetContent>
      <SheetHandle />
    </SheetContent>
  </SheetView>
</SheetRoot>

API

SheetRoot

The root component of the Sheet, containing all of its child components.

children
iOS
Android
Harmony
TypeReactNode
children
claimedGestureAngles
Typeundefined[]
Angle ranges (in degrees) where gestures should be claimed by the Sheet. Each entry is [minAngle, maxAngle]. Gestures within these angle ranges will trigger sheet movement, while gestures outside these ranges are passed through. see https://lynxjs.org/api/elements/built-in/view#consume-slide-event for more
className
iOS
Android
Harmony
Typestring
className
defaultShow
iOS
Android
Harmony
Typeboolean·Defaultfalse
Whether the sheet should be shown by default. Use this for uncontrolled mode.
dismissThreshold
Typenumber
The threshold to dismiss the Sheet.
dragDisabled
Typeboolean
Whether to disable dragging on the Sheet.
enableDragToClose
Typeboolean
Whether to enable dragging to close the Sheet. If true, dragging from the lowest snap point toward the closed edge will move the sheet linearly and allow dismissal. If false, dragging toward the closed edge will trigger rubber band effect and snap back.
enableRTL
Typeboolean·Defaultfalse
Whether logical drawer sides should resolve in RTL mode. When false, start means left and end means right. When true, start means right and end means left. Physical left and right sides are not affected by enableRTL.
forceMount
iOS
Android
Harmony
Typeboolean·Defaultfalse
Mount the sheet and render its content even when not shown. The sheet remains in closed state.
handleOnly
Typeboolean
Whether to restrict dragging to the handle only.
initialSnap
Typenumber
The initial snap point index.
onClose
iOS
Android
Harmony
Type() => void
Called when the sheet has fully closed and any exit animation has finished.
onOpen
iOS
Android
Harmony
Type() => void
Called when the sheet has fully opened and any enter animation has finished.
onShowChange
iOS
Android
Harmony
Type(open: boolean) => void
Called when the sheet's visibility is about to change (e.g., backdrop click, swipe dismiss, close button). In controlled mode, use this to update your state. In uncontrolled mode, this is optional.
onSnapChange
Type(index: number, value: number) => void
Callback when the snap point changes. value is the resolved snap point in pixels.
rubberBand
Typenumber | boolean | [object Object]
The rubber band effect configuration. By default, rubber band over-drag is enabled for vertical sheets (top / bottom) and disabled for horizontal drawers (left / right / start / end). If true, enables default rubber band effect (coefficient 0.5). If false, disables rubber band effect. If number, enables rubber band effect with the specified coefficient. If object, allows specifying coefficient and max distance.
screenHeight
Typenumber
The height of the Sheet container (screen height). Used in vertical sheet mode (top / bottom) for percentage snap points and dismissal calculations.
screenWidth
Typenumber
The width of the Sheet container (screen width). Used in horizontal drawer mode (left / right / start / end) for percentage snap points and dismissal calculations.
show
iOS
Android
Harmony
Typeboolean
Whether to show the sheet. If this property is set, the sheet will be in controlled mode, meaning the defaultShow property will have no effect. You must control the visibility by updating this prop based on user interactions.
side
TypeSheetSide·Default'bottom'
The side from which the sheet enters. bottom preserves the existing bottom-sheet behavior. top provides top-sheet behavior. left and right provide physical drawer behavior. start and end provide logical drawer behavior and resolve against enableRTL.
snapPoints
Typeundefined[]·Default['fit']
The snap points of the Sheet. Can be pixel numbers, percentages, or 'fit'. - Numbers are treated as pixel values - Percentages (e.g., '50%') are relative to screen height for top / bottom, and relative to screen width for left / right / start / end - 'fit' dynamically resolves to the measured content height for top / bottom, and the measured content width for left / right / start / end
style
iOS
Android
Harmony
TypeCSSProperties
style

SheetBackdrop

The backdrop mask of the Sheet.

children
iOS
Android
Harmony
TypeReactNode
children
className
iOS
Android
Harmony
Typestring
className
clickToClose
iOS
Android
Harmony
Typeboolean·Defaulttrue
Whether to close the Sheet when the overlay is clicked.
onClick
iOS
Android
Harmony
Type() => void
Triggered when the backdrop is clicked.
style
iOS
Android
Harmony
TypeCSSProperties
style

SheetView

The view container of the Sheet. Can be x-overlay-ng or view. Controls the Sheet's overlay layer and stacking order.

children
iOS
Android
Harmony
TypeReactNode
children
className
iOS
Android
Harmony
Typestring
className
container
iOS
Android
Harmony
Type'spark' | 'bullet' | 'bulletPopup' | (string & {})
If you want to render the Sheet outside of the LynxView, set this property. The values 'spark', 'bullet', and 'bulletPopup' are names of native containers. For example, on TikTok it should be 'spark', and on Douyin it should be 'bullet'. On iOS, this prop can also be any native view controller that should host the Sheet. Use it to place the Sheet in the correct native layer.
id
iOS
Android
Harmony
Typestring
id
nativeProps
iOS
Android
Harmony
TypeOverlayViewProps | ViewProps
Additional props that will be passed through to the underlying element.
overlayLevel
iOS
Android
Harmony
Type2 | 1 | 3 | 4
Only works when the 'container' is set to non-empty string. Adjust nearby elements display level.
style
iOS
Android
Harmony
TypeCSSProperties
style

SheetContent

The main content of the Sheet.

children
iOS
Android
Harmony
TypeReactNode
children
className
iOS
Android
Harmony
Typestring
className
enterAnimation
TypeSheetTransition
The enter animation configuration.
exitAnimation
TypeSheetTransition
The exit animation configuration.
innerClassName
iOS
Android
Harmony
Typestring
CSS class name for the inner layer. Use this for content layout and sizing styles. In horizontal drawer mode, the drawer width should be set here so 'fit' can resolve from the measured drawer width.
innerStyle
iOS
Android
Harmony
TypeCSSProperties
Inline styles for the inner layer. Use this for content layout and sizing styles. Note: Visual styles (background, borderRadius, etc.) should be set via the main style prop which applies to the moving surface layer. In horizontal drawer mode, set drawer width here so 'fit' can resolve from the measured drawer width.
snapAnimation
TypeSheetTransition
The transition configuration for the Sheet snap animation.
style
iOS
Android
Harmony
TypeCSSProperties
style
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.