BNA

BNA UI
24

Action Sheet

A native-feeling action sheet component that provides a menu of options triggered from the bottom of the screen.

Installation

pnpm dlx bna-ui add action-sheet

Usage

import { ActionSheet, useActionSheet } from '@/components/ui/action-sheet';

Basic Usage with Hook

function MyComponent() {
  const { show, ActionSheet } = useActionSheet();
 
  const handleShowActionSheet = () => {
    show({
      title: 'Choose an option',
      options: [
        {
          title: 'Edit',
          onPress: () => console.log('Edit pressed'),
        },
        {
          title: 'Delete',
          onPress: () => console.log('Delete pressed'),
          destructive: true,
        },
      ],
    });
  };
 
  return (
    <>
      <Button onPress={handleShowActionSheet}>Show Action Sheet</Button>
      {ActionSheet}
    </>
  );
}

Direct Component Usage

<ActionSheet
  visible={isVisible}
  onClose={() => setIsVisible(false)}
  title='Choose an action'
  message='Select one of the options below'
  options={[
    {
      title: 'Share',
      onPress: handleShare,
      icon: <ShareIcon />,
    },
    {
      title: 'Delete',
      onPress: handleDelete,
      destructive: true,
    },
  ]}
/>

Examples

Default

With Icons

Destructive Actions

Disabled Options

Custom Styling

Long Options List

With Hook

API Reference

ActionSheet

The main ActionSheet component.

PropTypeDefaultDescription
visibleboolean-Controls the visibility of the action sheet.
onClose() => void-Callback fired when the action sheet should close.
titlestring-Optional title displayed at the top.
messagestring-Optional message displayed below the title.
optionsActionSheetOption[]-Array of options to display in the action sheet.
cancelButtonTitlestring'Cancel'Text for the cancel button.
styleViewStyle-Additional styles for the action sheet container.

ActionSheetOption

Configuration for individual action sheet options.

PropTypeDefaultDescription
titlestring-The text to display for this option.
onPress() => void-Callback fired when this option is pressed.
destructivebooleanfalseWhether this option should use destructive styling.
disabledbooleanfalseWhether this option should be disabled.
iconReact.ReactNode-Optional icon to display next to the title.

useActionSheet Hook

A convenient hook for managing action sheet state.

Returns

PropertyTypeDescription
show(config: Omit<ActionSheetProps, 'visible' | 'onClose'>) => voidFunction to show the action sheet.
hide() => voidFunction to hide the action sheet.
ActionSheetReact.ReactElementThe ActionSheet component to render.
isVisiblebooleanCurrent visibility state.

Platform Behavior

iOS

On iOS, the ActionSheet automatically uses the native ActionSheetIOS API, providing the familiar iOS action sheet experience with proper integration into the system UI.

Android & Other Platforms

On Android and other platforms, a custom implementation is used that mimics the native behavior with smooth animations and proper theming support.

Accessibility

The ActionSheet component follows accessibility best practices:

  • Proper focus management when opened/closed
  • Screen reader announcements for destructive actions
  • Keyboard navigation support where applicable
  • Respects system accessibility settings

Animation

The ActionSheet includes smooth animations:

  • Slide-up animation from bottom of screen
  • Backdrop fade-in/out
  • Spring-based animations for natural feel
  • Respects reduced motion preferences

Theming

The ActionSheet automatically adapts to your app's theme:

  • Uses theme colors for background, text, and borders
  • Supports both light and dark modes
  • Destructive actions use theme's destructive color
  • Disabled states respect theme opacity values