Lynx

Bottom Sheet

A sheet component that slides up from the bottom of the screen, providing drag, snap, and dismiss interactions.

Engine ≥ 3.6<overlay>
Available since@seed-design/lynx-react@0.1.0, @seed-design/lynx-css@0.1.0
Loading Lynx example…

Installation

npx @seed-design/cli add ui:bottom-sheet

@seed-design/lynx-react's BottomSheet wraps @lynx-js/lynx-ui-sheet. Drag, spring, snap, and presence behaviors are handled by lynx-ui-sheet. Crispy provides public APIs and recipe slot styles.

Usage

import {
  BottomSheetBody,
  BottomSheetContent,
  BottomSheetFooter,
  BottomSheetRoot,
  BottomSheetTrigger,
} from "@/components/ui/bottom-sheet";

export function App() {
  return (
    <BottomSheetRoot snapPoints={["fit", "80%"]}>
      <BottomSheetTrigger>
        <text>Open sheet</text>
      </BottomSheetTrigger>
      <BottomSheetContent title="Title" description="Additional description" showHandle>
        <BottomSheetBody>
          <text>Body content</text>
        </BottomSheetBody>
        <BottomSheetFooter>
          <text>Bottom action area</text>
        </BottomSheetFooter>
      </BottomSheetContent>
    </BottomSheetRoot>
  );
}

The Registry BottomSheetContent internally assembles Positioner, Backdrop, and Header. BottomSheetTrigger must be placed outside Content to open the sheet by tapping.

In the low-level package API, specifying container to BottomSheet.Positioner uses the <overlay> XElement. The Registry default uses <view>. If you need container, verify that your app's Lynx Engine supports <overlay>.

Imperative Control

Pass ref to BottomSheetRoot to call the open, close, snapTo, expand, and collapse methods.

import { useRef } from "@lynx-js/react";
import { BottomSheetRoot, type BottomSheetRootRef } from "@/components/ui/bottom-sheet";

export function App() {
  const ref = useRef<BottomSheetRootRef>(null);

  return (
    <BottomSheetRoot ref={ref} snapPoints={["fit", "80%"]}>
      {/* ... */}
    </BottomSheetRoot>
  );
}

Props

BottomSheetRoot

Prop

Type

BottomSheetTrigger

Prop

Type

style?CSSProperties | undefined
children?ReactNode
className?string | undefined
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined

BottomSheetContent

Prop

Type

title?ReactNode
description?ReactNode

BottomSheetBody

Prop

Type

style?CSSProperties | undefined
children?ReactNode
className?string | undefined

BottomSheetFooter

Prop

Type

style?CSSProperties | undefined
children?ReactNode
className?string | undefined

Examples

Trigger

Tapping <BottomSheetTrigger> opens the Bottom Sheet. Lynx does not support asChild. Trigger renders a <view> that wraps child elements.

Loading Lynx example…

Controlled

To open and close the Bottom Sheet in ways other than using Trigger, control the state with open and onOpenChange. The example below opens the Bottom Sheet 1 second after tapping a button.

Loading Lynx example…

onOpenChange Details

Lynx's onOpenChange only passes the changed open value. The React version's details.reason is not supported. If you need the reason for opening or closing, record the reason in separate state from event handlers on buttons owned by your app and Trigger. Background tap and drag cannot be distinguished by callback value alone.

Header Align

Use headerAlign on <BottomSheetRoot> to align the title and description to the left or center.

Loading Lynx example…

Max Height

BottomSheetBody renders a native <view>. To create a scrollable area with a maximum of 300px, place <scroll-view> inside Body and specify height, maxHeight, and flex: "none" together. If you only specify maxHeight on Lynx's scroll-view, the area may shrink to 0px because content size cannot be calculated as height.

Loading Lynx example…

Snap Points

In snapPoints, you can use pixel numbers, percentages based on screen height, or "fit" to match content size. The array order becomes the snap index, and initialSnap specifies the height when first opened.

In onSnapChange, you can receive the current index and pixel-calculated height. Use ref's snapTo method to move to your desired height.

Loading Lynx example…

Verify the final behavior of drag and snap animations in Lynx Explorer from the QR code tab. Device and gesture handling results may differ in the document preview.

Fade From Index

Lynx does not support fadeFromIndex. Use the default Backdrop provided by Registry. If dim changes per snap index are absolutely necessary, assemble Backdrop directly with the low-level package API and control opacity based on onSnapChange state.

Show Handle

Pass showHandle to <BottomSheetContent> to display the Handle. The default is false.

Loading Lynx example…

Show Close Button

Lynx's BottomSheetContent does not support showCloseButton and CloseButton. If a close button is needed, use controlled state and change open to false from a button in BottomSheetFooter.

Dismissible

Lynx does not have a dismissible prop to control background tap, drag, and ESC close at once. Drag can be prevented with enableDragToClose={false} on BottomSheetRoot. If you also need to prevent background tap, assemble with the low-level package API and pass clickToClose={false} to BottomSheet.Backdrop. Lynx does not have ESC key close behavior like the web. If you've prevented close behavior, provide an explicit close button in Footer or elsewhere.

With Scroll Fog

BottomSheetBody is a native <view> that does not determine scroll method. If scroll hints are needed, place ScrollFog directly inside Body. In this structure, you can control size, placement, hideScrollBar, and native scroll-view props directly where they're used.

Native fading-edge-length displays fog only at edges where scrollable content remains. Initially at the bottom, it displays at the top when scrolled to the end.

Loading Lynx example…

Handle Only

Pass handleOnly to <BottomSheetRoot> to restrict the vertical gesture area that moves the Bottom Sheet to the Handle. Use this option together with <BottomSheetContent showHandle>. For long body text, this combination is recommended to prevent overlap between scroll areas inside Body and sheet drag.

Loading Lynx example…

Skip Animation

Pass skipAnimation to skip the enter, exit, and snap animations of the Bottom Sheet.

Loading Lynx example…

Web Version Differences

ItemWebLynx
User EventonClickbindtap
Rendering ElementsHTML elementsNative <view>, <text>, <scroll-view>
State Propopen, defaultOpen, onOpenChangeSame. Internally connected via lynx-ui-sheet's state API
Mount ControllazyMount, unmountOnExitNot supported in Registry. Controlled via forceMount in low-level BottomSheet.Positioner
Trigger CompositionasChild supportedNot supported. Renders <view>
Imperative ref APINoneopen, close, snapTo, expand, collapse

Table of contents