프리뷰 또는 이전 버전의 문서를 보고 있습니다.seed-design.io 방문
우리는 왜 디자인 엔지니어를 찾게 됐을까
Skip to Content
Lynx

Bottom Sheet

화면 하단에서 올라오는 시트 컴포넌트로, 드래그·snap·dismiss 상호작용을 제공합니다.

Engine ≥ 3.6<overlay>
사용 가능 버전@seed-design/[email protected], @seed-design/[email protected]
Lynx 예제를 불러오는 중입니다.

Installation

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

Usage

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

export function App() {
  return (
    <BottomSheetRoot snapPoints={["fit", "80%"]}>
      <BottomSheetTrigger>
        <text>시트 열기</text>
      </BottomSheetTrigger>
      <BottomSheetContent title="제목" description="부가 설명" showHandle>
        <BottomSheetBody>
          <text>본문 콘텐츠</text>
        </BottomSheetBody>
        <BottomSheetFooter>
          <text>하단 액션 영역</text>
        </BottomSheetFooter>
      </BottomSheetContent>
    </BottomSheetRoot>
  );
}

BottomSheetTrigger는 Content 밖에 두세요.

Imperative 제어

BottomSheetRoot에 ref를 전달하면 open, close, snapTo, expand, collapse 메서드를 호출할 수 있습니다. 이 메서드로 바꾼 열림 상태는 onOpenChange로 알리지 않습니다. open을 제어하는 경우에는 메서드 대신 open 값을 바꾸세요.

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

headerAlign?"center" | "left" | undefined

Default

"left"

skipAnimation?boolean | undefined

Default

false

side?SheetSide | undefined

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.

Default

'bottom'

enableRTL?boolean | undefined

Whether the Sheet should use RTL direction. This sets the Sheet viewport direction to rtl by default and resolves logical drawer sides 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.

Default

false

snapPoints?SheetSnapPoint[] | undefined

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

Default

['fit']
- `{ fit: true, min, max }` resolves to the measured content size clamped to `min` and `max`
The index order follows the order of this array.

initialSnap?number | undefined

The initial snap point index.

onSnapChange?((index: number, value: number) => void) | undefined

Callback when the snap point changes. value is the resolved snap point in pixels.

onActiveSnapChange?((index: number, value: number) => void) | undefined

시트가 스냅 지점으로 움직이기 시작할 때 목표를 알린다. 애니메이션이 끝나면 onSnapChange가 이어서 불린다. 목표 index가 직전 목표와 다를 때만 불리며, 열릴 때의 첫 스냅은 항상 알린다. 닫힘은 알리지 않는다. 진행 중인 스냅이 새 스냅에 끊기면 새 목표만 알리고, 끊긴 스냅의 onSnapChange는 불리지 않는다. value는 px로 환산한 스냅 지점이다.

fadeFromIndex?number | undefined

배경(Backdrop)이 어두워지는 snap 지점 index다. 시트가 snapPoints[fadeFromIndex] 위치 이상이면 배경 농도가 1, 그보다 작은 snap 지점 중 가장 큰 위치(없으면 닫힌 위치) 이하이면 0이고, 그 사이에서는 위치에 비례해 바뀐다. snap 지점이 크기 순서가 아니어도 위치로 비교한다. 범위를 벗어난 index는 가까운 끝 지점으로 맞추며, 지정하지 않거나 아직 측정하지 않은 'fit' 지점이면 가장 크게 열린 크기를 기준으로 0에서 1로 바뀐다.

screenHeight?number | undefined

The height of the Sheet container (screen height). Used in vertical sheet mode (top / bottom) for percentage snap points and dismissal calculations. Defaults to the measured height of the SheetView layer; percentage snap points wait for that measurement before entering.

screenWidth?number | undefined

The width of the Sheet container (screen width). Used in horizontal drawer mode (left / right / start / end) for percentage snap points and dismissal calculations. Defaults to the measured width of the SheetView layer; percentage snap points wait for that measurement before entering.

rubberBand?number | boolean | { coeff?: number; max?: number; } | undefined

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.

dragDisabled?boolean | undefined

Whether to disable dragging on the Sheet.

dismissThreshold?number | undefined

The threshold to dismiss the Sheet.

handleOnly?boolean | undefined

Whether to restrict dragging to the handle only.

enableDragToClose?boolean | undefined

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.

Default

true

flingEnabled?boolean | undefined

드래그를 놓을 때 속도로 위치를 투사해 snap 지점을 고를지 정한다. false면 놓은 위치에서 가장 가까운 snap 지점(또는 닫힘 기준선 아래면 닫힘)으로 간다.

Default

true

resolveRelease?((info: SheetReleaseInfo) => SheetReleaseDecision) | undefined

드래그를 놓을 때 기본 판정보다 먼저 불려 결과를 정한다. main thread에서 실행되므로 함수 본문 첫 줄에 "main thread" directive가 있어야 한다. { snap }이면 fling 없이 그 index로 snap하고, { close: true }이면 놓은 자리에서 닫으며(enableDragToClose와 관계없이), undefined이면 기본 판정을 쓴다. delta·velocity는 양수가 더 열리는 방향이다.

onPositionChange?((position: number) => void) | undefined

시트 위치(열린 크기, px)가 바뀔 때마다 불린다. 드래그, snap, 열림·닫힘 애니메이션의 매 프레임을 포함한다. main thread에서 실행되므로 함수 본문 첫 줄에 "main thread" directive가 있어야 한다. 시트 위치에 맞춰 시트 안의 요소 크기를 바꿀 때 쓴다.

claimedGestureAngles?[number, number][] | undefined

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

children?ReactNode

children

forceMount?boolean | undefined

Mount the sheet and render its content even when not shown. The sheet remains in closed state.

Default

false

onOpen?(() => void) | undefined

Called when the sheet has fully opened and any enter animation has finished.

onClose?(() => void) | undefined

Called when the sheet has fully closed and any exit animation has finished.

open?boolean | undefined

Whether the sheet is open (controlled mode). Internally mapped to show of the internal sheet engine.

defaultOpen?boolean | undefined

Whether the sheet is open by default (uncontrolled mode). Internally mapped to defaultShow.

Default

false

onOpenChange?((open: boolean, details: BottomSheetOpenChangeDetails) => void) | undefined

Called once when Trigger, CloseButton, Backdrop or a drag changes the open state, with the reason of the change. Changes made through the Root ref or the open prop are not reported.

onAnimationEnd?((open: boolean) => void) | undefined

Called when the sheet finishes opening (true) or closing (false), whatever changed the open state. false comes after the layer is removed from the screen, so UI shown from it (such as a snackbar) is not covered by or attached to the closing layer. With forceMount the layer stays mounted, so false only means the close finished and the layer is still on screen.

BottomSheetTrigger

고유 prop이 없습니다. className, style, children, bindtap을 받습니다.

BottomSheetContent

Prop

Type

title?ReactNode
description?ReactNode
container?"bullet" | "bulletPopup" | "spark" | (string & {}) | undefined
overlayLevel?1 | 2 | 3 | 4 | undefined
showCloseButton?boolean | undefined

Default

true

showHandle?boolean | undefined

Default

false

snapAnimation?SheetTransition | undefined

The transition configuration for the Sheet snap animation.

enterAnimation?SheetTransition | undefined

The enter animation configuration.

exitAnimation?SheetTransition | undefined

The exit animation configuration.

innerClassName?string | undefined

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?CSSProperties | undefined

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.

children?ReactNode

children

BottomSheetBody

고유 prop이 없습니다. className, style, children을 받습니다.

BottomSheetFooter

고유 prop이 없습니다. className, style, children을 받습니다.

Examples

Trigger

<BottomSheetTrigger>를 탭하면 Bottom Sheet가 열립니다. Lynx는 asChild를 지원하지 않습니다. Trigger는 자식 요소를 감싸는 <view>를 렌더링합니다.

Lynx 예제를 불러오는 중입니다.

Controlled

Trigger 외의 방식으로 Bottom Sheet를 열고 닫으려면 open과 onOpenChange로 상태를 제어합니다. 다음 예제는 버튼을 탭한 뒤 1초 후 Bottom Sheet를 엽니다.

Lynx 예제를 불러오는 중입니다.

onOpenChange Details

onOpenChange의 두 번째 인자는 { reason }입니다. Trigger로 열면 "trigger", 닫기 버튼으로 닫으면 "closeButton", 배경을 탭해 닫으면 "interactOutside", 시트를 끌어 닫으면 "drag"입니다. 닫히는 중에 시트를 다시 끌어 올리면 open이 true인 "drag"가 전달됩니다. Root ref의 메서드나 open prop으로 바꾼 상태에는 호출되지 않습니다. React 버전의 escapeKeyDown처럼 Lynx에 해당 입력이 없는 reason은 제공하지 않습니다.

onAnimationEnd

onAnimationEnd는 열림 애니메이션이 끝나면 true, 닫힘 애니메이션이 끝나면 false와 함께 호출됩니다. 열림 상태를 바꾼 방법과 관계없이 호출되며, Root ref의 메서드나 open prop으로 바꾼 경우도 포함합니다. false는 시트 레이어가 화면에서 제거된 뒤에 전달됩니다. 단, forceMount를 켜면 닫힌 뒤에도 레이어가 남아 있으므로 false는 닫힘이 끝났다는 뜻일 뿐 레이어 제거를 보장하지 않습니다.

시트를 닫은 뒤 스낵바처럼 화면 위에 뜨는 native UI를 띄우려면 onOpenChange 대신 onAnimationEnd에서 호출하세요. container로 띄운 시트가 닫히는 중에 호출하면 native UI가 닫히는 overlay에 붙어 함께 사라질 수 있습니다.

<BottomSheetRoot
  open={open}
  onOpenChange={setOpen}
  onAnimationEnd={(open) => {
    if (!open && submitted) showSnackbar("저장했어요");
  }}
>
  {/* ... */}
</BottomSheetRoot>

Header Align

<BottomSheetRoot>의 headerAlign으로 title과 description을 왼쪽 또는 가운데에 정렬할 수 있습니다.

Lynx 예제를 불러오는 중입니다.

Long Content

시트 높이가 내용에 맞춰 정해지면 화면 높이의 90%를 넘지 않고, 위쪽 inset이 그보다 크면 inset 아래까지로 제한됩니다. 제한에 닿으면 BottomSheetBody가 스크롤됩니다. Body가 스크롤된 상태에서 시작한 제스처는 Body만 움직이고, Body가 맨 위에 있을 때 아래로 끌어야 시트가 움직입니다.

Lynx 예제를 불러오는 중입니다.

Max Height

BottomSheetBody는 내용이 넘치면 세로로 스크롤합니다. 스크롤 영역을 최대 300px로 제한하려면 Body에 maxHeight를 지정하세요.

Lynx 예제를 불러오는 중입니다.

Snap Points

snapPoints에는 픽셀 숫자, 백분율, 콘텐츠 크기에 맞추는 "fit"을 사용할 수 있습니다. 백분율은 시트가 그려지는 BottomSheetPositioner 레이어의 높이를 기준으로 하고, screenHeight를 지정하면 그 값을 기준으로 합니다. 레이어는 container가 없으면 LynxView, container="window"이면 window를 채우므로, 내용 높이로 삽입된 LynxView에서도 시트 높이가 줄어들지 않습니다. 백분율 snap point는 레이어를 측정한 뒤 열리기 시작합니다. 배열 순서가 snap index가 되며, initialSnap으로 처음 열릴 높이를 정합니다.

onSnapChange에서는 현재 index와 픽셀로 계산된 높이를 받을 수 있습니다. ref의 snapTo 메서드를 사용하면 원하는 높이로 이동할 수 있습니다.

범위가 있는 fit({ fit: true, min, max })을 쓰면 내용 높이를 따르되 min과 max 사이로 맞춥니다. min·max에는 픽셀 숫자나 백분율을 쓸 수 있습니다. 내용이 max보다 길면 Body가 스크롤되고, min보다 짧으면 시트가 min 높이를 채웁니다. 내용 높이가 바뀌면 현재 snap index의 범위로 다시 맞춥니다. 내용이 짧아 두 snap point가 같은 높이가 되면, 드래그를 놓거나 expand·collapse를 호출해도 현재 index를 유지합니다.

<BottomSheetRoot
  snapPoints={[
    { fit: true, min: 320, max: "50%" },
    { fit: true, min: 320, max: 640 },
  ]}
>
  {/* 처음에는 화면의 절반까지, 끌어 올리면 640px까지 내용에 맞춰 열립니다. */}
</BottomSheetRoot>

onActiveSnapChange는 시트가 snap point로 움직이기 시작할 때 목표 index와 높이를 받습니다. 애니메이션이 끝나면 onSnapChange가 이어서 호출되므로, 드래그를 놓는 순간 목표에 맞춰 UI를 바꿀 때 사용하세요. 목표가 직전 목표와 같으면 호출되지 않고, 시트가 열릴 때의 첫 snap은 항상 알립니다. 닫힘은 onOpenChange로 알리므로 호출되지 않습니다. 진행 중인 snap이 다른 snap으로 바뀌면 새 목표만 다시 알리고, 중단된 snap의 onSnapChange는 호출되지 않습니다.

Lynx 예제를 불러오는 중입니다.

드래그와 snap 애니메이션의 최종 동작은 QR 코드 패널에서 Lynx Explorer로 확인하세요. 문서 미리보기에서는 기기와 제스처 처리 결과가 다를 수 있습니다.

Fade From Index

<BottomSheetRoot>에 fadeFromIndex를 전달하면 Backdrop이 어두워지는 snap point를 정할 수 있습니다. 시트가 snapPoints[fadeFromIndex] 높이 이상이면 Backdrop이 완전히 어둡고, 그 바로 아래 snap point 높이 이하에서는 투명하며, 그 사이에서는 시트 위치에 비례해 바뀝니다. 아래 snap point가 없으면 닫힌 위치부터 어두워집니다. 범위를 벗어난 index는 가까운 끝 snap point로 맞춥니다. 지정하지 않으면 가장 크게 열린 높이를 기준으로 농도가 바뀝니다.

<BottomSheetRoot snapPoints={["40%", "80%"]} fadeFromIndex={1}>
  {/* 40%에서는 Backdrop이 투명하고, 80%로 끌어 올리면서 어두워집니다. */}
</BottomSheetRoot>

Show Handle

<BottomSheetContent>에 showHandle을 전달하면 Handle을 표시합니다. 기본값은 false입니다.

Lynx 예제를 불러오는 중입니다.

Show Close Button

<BottomSheetContent>에 showCloseButton prop을 전달하여 닫기 버튼을 표시할 수 있습니다. 기본값은 true입니다.

showCloseButton을 false로 설정하면 닫기 버튼이 표시되지 않습니다. 이 경우 사용자가 Bottom Sheet를 닫을 수 있는 방법을 제공해야 합니다.

Lynx 예제를 불러오는 중입니다.

Dismissible

Lynx에는 배경 탭, 드래그, ESC 닫기를 한 번에 제어하는 dismissible prop이 없습니다. enableDragToClose={false}로 드래그 닫기만 막을 수 있으며, Registry에서는 배경 탭 닫기를 끌 수 없습니다. ESC 키 닫기도 지원하지 않습니다. 닫기 동작을 막았다면 Footer 등에 닫기 버튼을 제공하세요.

With Scroll Fog

스크롤 힌트가 필요하면 Body 안에 Scroll Fog와 세로 <scroll-view>를 배치하세요. Body의 스크롤 영역 안에서는 height: "100%"가 기준으로 삼을 높이가 없으므로, ScrollFog에 고정 높이를 지정해야 합니다. fog 방향과 크기는 ScrollFog의 placement·size로, 스크롤바와 스크롤 동작은 <scroll-view> prop으로 제어합니다. 이 <scroll-view>의 스크롤을 시트 드래그와 조정하려면 useBottomSheetScrollHandoff()가 돌려준 props를 펼치세요. 펼치지 않으면 스크롤한 상태에서 아래로 끌 때 시트도 함께 움직입니다.

ScrollFog는 스크롤 위치와 관계없이 항상 효과를 표시하므로, <scroll-view>에 권장 padding인 상단 20px, 하단 80px을 지정해야 합니다.

Lynx 예제를 불러오는 중입니다.

Drag Release

드래그를 놓으면 기본으로 놓은 속도만큼 위치를 투사해 가장 가까운 snap point로 가거나, 닫힘 기준선을 지나면 닫힙니다. flingEnabled={false}를 전달하면 속도를 무시하고 놓은 위치에서 가장 가까운 snap point로 갑니다.

resolveRelease로 놓았을 때의 결과를 직접 정할 수 있습니다. main thread에서 실행되므로 함수 첫 줄에 "main thread" directive가 있어야 합니다. 드래그를 시작할 때의 snap index(index), 놓은 위치(offset), 시작 위치에서의 변화(delta), 속도(velocity), touchcancel 여부(canceled)를 받습니다. delta와 velocity는 양수가 더 열리는 방향입니다. { snap: index }를 반환하면 그 snap point로 가고, { close: true }를 반환하면 닫히며, undefined를 반환하면 기본 판정을 따릅니다.

<BottomSheetRoot
  snapPoints={["40%", "80%"]}
  resolveRelease={({ index, delta }) => {
    "main thread";
    // 조금만 끌어 올려도 다음 snap point로 넘깁니다.
    if (index === 0 && delta > 40) return { snap: 1 };
    return undefined;
  }}
>
  {/* ... */}
</BottomSheetRoot>

Position Change

onPositionChange는 시트 위치가 바뀔 때마다 시트가 열린 높이(px)를 받습니다. 드래그, snap, 열림·닫힘 애니메이션의 매 프레임에 호출됩니다. main thread에서 실행되므로 함수 첫 줄에 "main thread" directive가 있어야 합니다. 시트를 끄는 동안 시트 안의 스크롤 영역 높이를 시트 높이에 맞출 때처럼, 렌더링을 기다리지 않고 요소를 바꿀 때 사용하세요.

const listMTRef = useMainThreadRef<MainThread.Element>(null);

<BottomSheetRoot
  snapPoints={["40%", "80%"]}
  onPositionChange={(position) => {
    "main thread";
    // 헤더 높이 56px을 뺀 만큼 목록을 보여 줍니다.
    listMTRef.current?.setStyleProperty("height", `${Math.max(0, position - 56)}px`);
  }}
>
  {/* <view main-thread:ref={listMTRef}>...</view> */}
</BottomSheetRoot>

Scroll Handoff

BottomSheetBody는 스크롤 영역과 시트 드래그를 조정합니다. 목록이 스크롤된 상태에서 시작한 제스처와 맨 위에서 위로 미는 제스처는 목록이 스크롤하고, 맨 위에서 아래로 끄는 제스처는 시트를 끕니다.

Body 밖에 직접 둔 <scroll-view>나 <list>에는 useBottomSheetScrollHandoff()가 돌려준 props를 펼쳐 같은 동작을 줍니다. scrollEnabled: false를 넘기면 목록이 스크롤하지 않고 세로 제스처를 시트가 모두 받습니다. topThreshold는 맨 위로 볼 scrollTop 값입니다. 슬라이더처럼 시트 드래그를 막아야 하는 영역에는 useBottomSheetNoDrag()가 돌려준 props를 펼치세요. 그 영역에서 시작한 제스처는 시트가 받지 않습니다. 두 훅은 BottomSheetContent 안에서만 판정하며, 그 밖에서는 useBottomSheetScrollHandoff()가 enable-scroll만 돌려줍니다.

function Notifications() {
  const handoffProps = useBottomSheetScrollHandoff();
  return (
    <list {...handoffProps} scroll-orientation="vertical">
      {/* ... */}
    </list>
  );
}

Handle Only

<BottomSheetRoot>에 handleOnly를 전달하면 Bottom Sheet를 움직이는 세로 제스처 영역이 Handle로 제한됩니다. 이 옵션은 <BottomSheetContent showHandle>과 함께 사용하세요. 본문이 길 때는 Body 안의 스크롤 영역과 시트 드래그가 겹치지 않도록 이 조합을 권장합니다.

Lynx 예제를 불러오는 중입니다.

Portalled

container를 지정하지 않으면 Bottom Sheet는 Lynx view 안에 렌더링됩니다. container="window"처럼 native container 이름을 지정하면 host 화면까지 덮는 native overlay에 렌더링됩니다. overlayLevel은 overlay의 표시 순서를 정합니다. 이 기능을 사용할 때는 앱의 Lynx Engine이 <overlay>를 지원해야 합니다. container를 지정하면 시트의 Safe Area 여백은 SeedProvider에 넘긴 windowSafeAreaInsets를 따릅니다. 값을 넘기지 않았으면 safeAreaInsets를 따릅니다.

Lynx 예제를 불러오는 중입니다.

Skip Animation

skipAnimation을 전달하면 Bottom Sheet의 enter, exit, snap 애니메이션을 건너뜁니다.

Lynx 예제를 불러오는 중입니다.

웹 버전과의 차이

  • onOpenChange의 reason은 trigger, closeButton, interactOutside, drag만 제공합니다.
  • Trigger는 자식을 native view로 감싸며 asChild를 제공하지 않습니다.
  • Root ref의 open, close, snapTo, expand, collapse로 시트를 제어할 수 있습니다. ref로 바꾼 상태는 onOpenChange로 알리지 않습니다.
  • container와 overlayLevel로 native overlay의 위치와 표시 순서를 지정합니다.
  • Registry에서는 lazyMount와 unmountOnExit을 지원하지 않습니다.

Last updated on 2026. 12. 1.