React

Bottom Sheet

A modal component that slides up from the bottom of the screen. It is used when providing additional information or action lists while maintaining the current context.

Available since@seed-design/react@0.0.1, @seed-design/css@0.0.1

Stackflow

Learn how to use Stackflow and Bottom Sheet together.

Installation

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

Props

BottomSheetRoot

Prop

Type

children?React.ReactNode
activeSnapPoint?string | number | null | undefined
setActiveSnapPoint?((snapPoint: number | string | null) => void) | undefined
open?boolean | undefined
onOpenChange?((open: boolean, details?: DrawerChangeDetails) => void) | undefined
onDrag?((event: React.PointerEvent<HTMLDivElement>, percentageDragged: number) => void) | undefined
onRelease?((event: React.PointerEvent<HTMLDivElement>, open: boolean) => void) | undefined
nested?boolean | undefined
onClose?(() => void) | undefined
container?HTMLElement | null | undefined
autoFocus?boolean | undefined

BottomSheetTrigger

Prop

Type

BottomSheetContent

Prop

Type

title?React.ReactNode
description?React.ReactNode
layerIndex?number | undefined

BottomSheetBody

Prop

Type

paddingX?ResponsiveValue<0 | (string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText"> | undefined
height?ResponsiveValue<(string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "full"> | undefined
maxHeight?ResponsiveValue<(string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "full"> | undefined
minHeight?ResponsiveValue<(string & {}) | Dimension | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | "spacingY.betweenText" | "full"> | undefined
justifyContent?"flex-start" | "flex-end" | "center" | "space-between" | "space-around" | undefined
alignItems?"flex-start" | "flex-end" | "center" | "stretch" | undefined

BottomSheetFooter

Prop

Type

Examples

Trigger

<BottomSheetTrigger> uses the asChild pattern to allow child elements to open the BottomSheet.

<BottomSheetTrigger> sets the aria-haspopup="dialog" attribute and automatically sets the aria-expanded attribute based on the open state of the BottomSheet. This attribute is useful for assistive technologies like screen readers.

Controlled

You can open and close the BottomSheet in ways other than using the trigger. In this case, use the open prop to control the state of the BottomSheet.

onOpenChange Details

The second argument of onOpenChange provides details.

reason

When opening (open: true)

  • "trigger": Opened with BottomSheetTrigger (BottomSheet.Trigger)

When closing (open: false)

  • "closeButton": Closed with BottomSheet.CloseButton
  • "escapeKeyDown": Using the ESC key
  • "interactOutside": Clicking outside the area
  • "drag": Closed by dragging
  • "handleClickOnLastSnapPoint": Closed by clicking the handle at the last snap point

Header Align

Set the headerAlign prop on <BottomSheetRoot> to control the alignment of the title and description.

Max Height

Pass the maxHeight prop to <BottomSheetBody> to set the maximum height of the BottomSheet.

Snap Points

Use the snapPoints prop to set custom snap points for the BottomSheet.

Fade From Index

Pass the fadeFromIndex prop to <BottomSheetRoot> to set the starting index where the background darkens.

Show Handle

Pass the showHandle prop to <BottomSheetContent> to display the handle. The default value is false.

Show Close Button

Pass the showCloseButton prop to <BottomSheetContent> to display the close button. The default value is true.

When showCloseButton is set to false, the close button is not displayed. In this case, you must provide a way for users to close the BottomSheet.

Dismissible

When the dismissible prop is set to false, the closeOnEscape, closeOnInteractOutside, and draggable features are disabled. Use this when you intentionally want to prevent the BottomSheet from being closed. Otherwise, you must provide a way for users to close the BottomSheet.

With Scroll Fog

You can apply a scroll hint effect using Scroll Fog in <BottomSheetBody>.

ScrollFog always displays the effect, so sufficient padding must be provided. The recommended padding is 80px at the bottom and 20px at the top.

Handle Only

When the handleOnly prop is provided to <BottomSheetRoot>, the area where the Bottom Sheet can be moved by swiping is limited to the handle.

This option only works when used with <BottomSheetContent showHandle={true}>.

Skip Animation

Use the skipAnimation prop to skip the enter/exit animation of the BottomSheet.

Table of contents