React

Swipeable Menu Sheet

A sheet-style component that provides options related to the user's action.

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

Stackflow

Learn how to use Stackflow and Swipeable Menu Sheet together.

Installation

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

Props

SwipeableMenuSheetRoot

Prop

Type

children?React.ReactNode
open?boolean | undefined
onOpenChange?((open: boolean, details?: DrawerChangeDetails) => void) | undefined

SwipeableMenuSheetTrigger

Prop

Type

SwipeableMenuSheetContent

Prop

Type

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

SwipeableMenuSheetGroup

Prop

Type

SwipeableMenuSheetItem

Prop

Type

prefixIcon?React.ReactNode
labelReact.ReactNode
description?React.ReactNode

Examples

Trigger

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

Unlike MenuSheet, the sheet can be closed with a swipe-down gesture. A handle at the top of the sheet provides drag affordance. The showCloseButton prop of SwipeableMenuSheetContent can display a visible close button, and at the default (false), a visually hidden close button is rendered for screen reader users.

Controlled

You can open and close the SwipeableMenuSheet in ways other than the Trigger. In this case, use the open prop to control the SwipeableMenuSheet's state.

With Title

Use the title prop of SwipeableMenuSheetContent to display a title in the sheet header.

With Title and Description

Use the description prop of SwipeableMenuSheetContent to add a supplementary description below the title.

Close Button

Use the showCloseButton prop of SwipeableMenuSheetContent to display a close button at the bottom of the sheet. The default is false, in which case a visually hidden close button is rendered for screen reader users.

Label Align

Set the label alignment of menu items using the labelAlign prop of SwipeableMenuSheetContent.

labelAlign="left" (with PrefixIcon)

Align labels to the left.

labelAlign="center" (without PrefixIcon)

Center-align labels. (Typically when prefixIcon is absent)

Overriding labelAlign

If needed, you can override the labelAlign specified on SwipeableMenuSheetContent with the labelAlign specified on SwipeableMenuSheetGroup or SwipeableMenuSheetItem.

onOpenChange Details

details is provided as the second argument to onOpenChange.

reason

When opening (open: true)

  • "trigger": Opened by SwipeableMenuSheetTrigger (SwipeableMenuSheet.Trigger)

When closing (open: false)

  • "closeButton": Closed by the close button (SwipeableMenuSheet.CloseButton) (when showCloseButton is false, it is a visually hidden button, mainly for screen reader users)
  • "escapeKeyDown": ESC key pressed
  • "interactOutside": Click outside area
  • "drag": Closed by swipe gesture

Skip Animation

You can skip the enter/exit animation of SwipeableMenuSheet using the skipAnimation prop.

Table of contents