tapcn
Components

Action Sheet

An iOS-style bottom action sheet with grouped actions and cancel button.

Open Action Sheet

Action Sheet

An iOS-style action sheet that slides up from the bottom. Displays a group of contextual actions with an optional title, message, and a separated cancel button.

Installation

npx @tapcn/cli add action-sheet

Or using shadcn directly:

npx shadcn@latest add https://tapcn.vercel.app/r/action-sheet.json

Usage

import { useState } from 'react';
import {
  ActionSheet,
  ActionSheetContent,
  ActionSheetAction,
  ActionSheetCancel,
} from '~/components/ui/action-sheet';
import { Button } from '~/components/ui/button';
import { Text } from '~/components/ui/text';

export function Example() {
  const [open, setOpen] = useState(false);

  return (
    <ActionSheet open={open} onOpenChange={setOpen}>
      <Button onPress={() => setOpen(true)}>
        <Text>Show Actions</Text>
      </Button>
      <ActionSheetContent title="Photo Options" message="Choose an action for this photo.">
        <ActionSheetAction onPress={() => console.log('Save')}>
          Save to Library
        </ActionSheetAction>
        <ActionSheetAction onPress={() => console.log('Share')}>
          Share
        </ActionSheetAction>
        <ActionSheetAction destructive onPress={() => console.log('Delete')}>
          Delete Photo
        </ActionSheetAction>
        <ActionSheetCancel />
      </ActionSheetContent>
    </ActionSheet>
  );
}

Sub-Components

ComponentDescription
ActionSheetRoot provider component. Controls open state.
ActionSheetContentThe sheet panel with backdrop, optional title/message, and action groups.
ActionSheetActionA pressable action row inside the sheet.
ActionSheetCancelA separated cancel button rendered in its own rounded group.

Props

ActionSheet

PropTypeDefaultDescription
openboolean--Whether the action sheet is visible.
onOpenChange(open: boolean) => void--Callback when the open state changes.
childrenReactNode--Child components.

ActionSheetContent

PropTypeDefaultDescription
titlestring--Optional title displayed at the top of the actions group.
messagestring--Optional message displayed below the title.
classNamestring--Additional NativeWind classes.
childrenReactNode--ActionSheetAction and ActionSheetCancel components.

ActionSheetAction

PropTypeDefaultDescription
onPress() => void--Callback when the action is pressed. The sheet auto-closes after.
destructivebooleanfalseRenders the action text in the destructive color.
classNamestring--Additional NativeWind classes.
childrenReactNode--Action label text.

ActionSheetCancel

PropTypeDefaultDescription
classNamestring--Additional NativeWind classes.
childrenReactNode"Cancel"Custom cancel label. Defaults to "Cancel".

Platform Behavior

  • Web: The backdrop uses fixed positioning. Action text uses select-none and cursor-default.
  • Native: Uses React Native Modal with transparent background and animated overlays.
  • Both platforms use react-native-reanimated for spring-based slide-in and fade animations.

Dependencies

  • react-native-reanimated -- enter/exit animations

On this page