Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Mobile

Bottom sheet

A panel that rises from the bottom of the screen, within easy reach on a phone.

Selector: mui-bottom-sheet

Import
import { BottomSheet } from '@mushilu-san/ui/mobile';
PreviewCode

Loading example…

Overview

Bottom sheet is a modal panel anchored to the bottom edge. open is a two-way model. It has a drag handle by default (showHandle), closes on the backdrop and Escape unless those are turned off, and returns focus to its trigger on close.

It labels itself with heading and is aria-modal, so it behaves like a dialog for assistive technology.

When to use

  • Choosing among actions for one item on a phone, such as "Share" or "Move to folder".
  • A short form or filter that should stay close to the thumb.

When not to use

  • Large content or a long form. Use a dialog or a full page. Use Dialog instead.
  • A side panel on a desktop layout. Use a sheet. Use Sheet instead.

Guidelines

Do

  • Give the sheet a heading that names the item or the action set.
  • Keep actions to about five or fewer.

Don't

  • Do not nest a bottom sheet inside another sheet or dialog.

Accessibility

Roles and attributes

ElementRoleNotes
paneldialog (modal)aria-modal="true", named by heading.
handle—Decorative (aria-hidden). Dragging is a convenience, not the only way to close.
close buttonbuttonLabelled "Close".

Keyboard

KeysAction
TabShiftTabCycles focus inside the sheet.
EscapeCloses the sheet when closeOnEscape is on (default).
  • Every action must be reachable with a keyboard, not only by swiping.

API

BottomSheet

Selector: mui-bottom-sheet

NameTypeDefaultDescription
headingstring | undefined— Optional heading — wires up aria-labelledby when present.
size'sm' | 'md' | 'lg' | 'full''md' Sheet height preset.
showHandlebooleantrue Show the drag-handle affordance at the top of the sheet. Accepts attribute presence, e.g. <… showHandle>.
closeOnBackdropbooleantrue Closes the sheet when the backdrop is tapped. Default `true`. Accepts attribute presence, e.g. <… closeOnBackdrop>.
closeOnEscapebooleantrue Closes the sheet on Escape. Default `true`. Accepts attribute presence, e.g. <… closeOnEscape>.
NameTypeDefaultDescription
openbooleanfalse Two-way open state.
NameTypeDescription
openedvoid Emits when the sheet opens.
closedvoid Emits when the sheet closes, however it was closed.

CSS parts

  • ::part(body)
  • ::part(close)
  • ::part(footer)
  • ::part(handle)
  • ::part(header)
  • ::part(panel)
  • ::part(root)
  • ::part(surface)
  • ::part(title)

Tokens

  • --mui-color-surface-raised
  • --mui-color-border
  • --mui-shadow-5
  • --mui-z-modal
  • --mui-radius-md
  • --mui-touch-target