Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Navigation

  • TabBar
  • Fab

Overlays

  • ActionSheet

Input

  • Picker

Gestures

  • SwipeAction
  • PullToRefresh

Layout

  • SafeArea

ActionSheet

action-sheet

Presents touch-friendly actions in a modal sheet from the bottom edge.

Usage

Basic usage

Trigger triggers, actions array drives each action; each item is automatically closed after being clicked.

tsx
<ActionSheet>
  <ActionSheetTrigger>Open the action panel</ActionSheetTrigger>
  <ActionSheetContent
    actions={[
      { key: "save", label: "Save to album" },
      { key: "share", label: "Share" },
    ]}
  />
</ActionSheet>

Title and Description

title / description is displayed at the top; action items can have description small characters.

tsx
<ActionSheetContent
  title="Picture operation"
  description="Select an action on this picture"
  actions={[
    { key: "save", label: "Save to album" },
    { key: "share", label: "Share", description: "Send to friends or circle of friends" },
  ]}
/>

Dangerous action

action.danger red highlight; cancelText customized or passed null hidden cancel block.

tsx
<ActionSheetContent
  title="Delete Confirm"
  cancelText="Think again"
  actions={[
    { key: "delete", label: "Delete", danger: true },
  ]}
/>

When to Use

Use it to present a bottom sheet of actions such as save, share, or delete on mobile, with a separate Cancel block. Use Fab for one persistent primary action. Use Picker for wheel-based selection of values such as a time or region.

Import

ts
import { ActionSheet, ActionSheetTrigger, ActionSheetClose, ActionSheetContent } from "@hulianui/ui"

Props

ActionSheet accepts the Base UI Dialog.Root props, including the usual controlled or uncontrolled open state and onOpenChange. ActionSheetTrigger and ActionSheetClose are direct Base UI Dialog counterparts.

ActionSheetContent Props

NameTypeDefaultDescription
actions *ActionSheetAction[]-Actions listed below; selecting any action closes the sheet
containerHTMLElement | nulldocument.bodyPortal container; pass an ancestor such as a transformed, overflow-hidden device frame to contain both backdrop and sheet
classNamestring--

ActionSheetAction: key: string · label: ReactNode · description?: ReactNode (supporting text) · danger?: boolean (destructive red treatment) · disabled?: boolean · onClick?: () => void.

Events

EventTypeDescription
onOpenChange(open: boolean) => voidCalled by ActionSheet (Dialog.Root) when its open state changes; forwarded from Base UI Dialog

Slots

Content injection slot for ActionSheetContent:

SlotTypeDescription
titleReactNodeTop title
descriptionReactNodeSupporting text below the title
cancelTextReactNode | nullCancel-button content; defaults to "\u53d6\u6d88" (Cancel); pass null to hide the cancel block

Usage Guidelines

  • Selecting an action calls its onClick before the enclosing Close dismisses the sheet. Do not close it manually.
  • The portal defaults to document.body. To keep the sheet inside a device frame or demo container, point container at the transformed or overflow-hidden ancestor; otherwise the backdrop covers the viewport.

Related

TabBar · Fab · Picker · SwipeAction · PullToRefresh · SafeArea

PreviousFabMobileNextPicker

On this page

  • Usage
  • Documentation
    • When to Use
    • Import
    • Props
    • Events
    • Slots
    • Usage Guidelines
    • Related