ActionSheet
A flexible modal overlay component that slides in from any direction to present contextual actions or content. Built with compound pattern for maximum composition flexibility.
Install Dependencies
npx quickcode-ui add ActionSheetOpen from Bottom
Open from Bottom
Open from Top
Open from Top
Open from Left
Open from Left
Open from Right
Open from Right
ActionSheet Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | ActionSheet sub-components |
isOpen | boolean | - | Controls visibility of the action sheet |
onClose | () => void | - | Callback when action sheet closes |
position | "bottom" | "top" | "left" | "right" | "bottom" | Position to slide in from |
variant | "default" | "filled" | "bordered" | "default" | Visual style variant |
size | "sm" | "md" | "lg" | "md" | Size affecting text and padding |
className | string | - | Additional CSS classes |
ActionSheet.Trigger Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Trigger button content |
asChild | boolean | false | Compose with child element instead of Button |
className | string | - | Additional CSS classes |
ActionSheet.Header Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Header content (Title, Description) |
showCloseButton | boolean | true | Show X close button |
className | string | - | Additional CSS classes |
ActionSheet.Title Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Title text |
className | string | - | Additional CSS classes |
ActionSheet.Description Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Description text |
className | string | - | Additional CSS classes |
ActionSheet.Content Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Content (Actions or custom content) |
showScroll | boolean | true | Show scrollbar when content overflows |
className | string | - | Additional CSS classes |
ActionSheet.Actions Props
| Prop | Type | Default | Description |
|---|---|---|---|
actions | ActionSheetAction[] | - | Array of action objects |
className | string | - | Additional CSS classes |
ActionSheet.Footer Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Custom footer content |
cancelLabel | string | "Cancel" | Cancel button label |
className | string | - | Additional CSS classes |
ActionSheetAction Interface
| Property | Type | Required | Description |
|---|---|---|---|
label | string | ✓ | Text displayed for the action |
onClick | () => void | ✓ | Function called when action is selected |
variant | "default" | "destructive" | ✗ | Visual style, destructive shows in red |
disabled | boolean | ✗ | Whether the action is disabled |
icon | React.ReactNode | ✗ | Optional icon displayed before the label |
Custom Content & Mixed Actions
Mix ActionSheet.Actions with custom JSX, or use completely custom content:
// Mixed: Actions + Custom
<ActionSheet.Content>
<ActionSheet.Actions actions={actions} />
<div className="mt-4 pt-4 border-t border-border">
<button className="w-full p-3 border border-border rounded hover:bg-muted">
Custom Button
</button>
</div>
</ActionSheet.Content>
// Fully Custom Content
<ActionSheet.Content>
<div className="space-y-4">
<div className="border-2 border-dashed border-border rounded-lg p-8 text-center">
<Upload className="w-8 h-8 mx-auto mb-2 text-muted-foreground" />
<p className="text-sm text-muted-foreground">Drag files here</p>
</div>
<div className="flex gap-2">
<button className="flex-1 p-2 border border-border rounded">Camera</button>
<button className="flex-1 p-2 border border-border rounded">Gallery</button>
</div>
</div>
</ActionSheet.Content>
// Custom Footer for Left/Right positions
<ActionSheet.Footer>
<button className="w-full p-2 text-sm border border-border rounded">
Custom Footer Action
</button>
</ActionSheet.Footer>Last updated on