- Accordion
- Action BarUpdated
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- BadgeUpdated
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- CalendarUpdated
- CardUpdated
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context MenuUpdated
- Data List
- Date Picker
- DialogUpdated
- DrawerUpdated
- Editable
- FieldUpdated
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- MarqueeUpdated
- Menu
- Native Select
- Number InputUpdated
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- TableUpdated
- Tabs
- Textarea
- TimerUpdated
- ToastUpdated
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation#
pnpm dlx shadcn@latest add @shark/editable
Anatomy#
Editable ├── EditableArea │ ├── EditablePreview │ └── EditableInput └── EditableControl ├── EditableEditTrigger ├── EditableCancelTrigger └── EditableSubmitTrigger
Usage#
import { Editable, EditableArea, EditableInput, EditablePreview, EditableControl, EditableCancelTrigger, EditableSubmitTrigger, EditableEditTrigger, } from "@/components/ui/editable";
<Editable> <EditableArea> <EditableInput /> <EditablePreview /> </EditableArea> <EditableControl> <EditableCancelTrigger/> <EditableSubmitTrigger/> <EditableEditTrigger/> </EditableControl> </Editable>
Controlled#
Make the entire form editable at once by using the edit prop.
The value and onValueChange props control the editable component programmatically.
Modes#
The activationMode prop controls how editing is triggered.
Focus#
Editing starts when the field receives focus.
Click#
Editing starts with a single click on the preview.
Double-Click#
Editing starts with a double-click on the preview.
None#
No automatic activation. Use EditableEditTrigger to manually start editing.
Sizes#
The size prop on EditablePreview controls the preview dimensions.
Small#
Large#
Orientation#
The orientation prop controls the layout of the editable component and its controls.
Horizontal#
Vertical#
Examples#
With Textarea#
Without Controls#
Edit without control buttons. Press Enter to save, Escape to cancel.
API Reference#
Editable#
Root component. Manages edit mode and value.
| Prop | Type | Default |
|---|---|---|
activationMode | focus | dblclick | click | none | 'focus' |
orientation | "horizontal" | "vertical" | "horizontal" |
submitMode | both | enter | blur | none | 'both' |
asChild | boolean | - |
className | string | - |
EditableArea#
Wraps the input and preview views.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableInput#
Input shown when editing. Use asChild for custom input elements.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditablePreview#
Shows the value when not editing. Click to enter edit mode.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
size | "xs" | "sm" | "md" | "lg" | "xl" | "md" |
className | string | - |
EditableControl#
Holds edit/cancel/submit control buttons.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableEditTrigger#
Enters edit mode on click.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableCancelTrigger#
Cancels editing and reverts to previous value.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableSubmitTrigger#
Submits the edited value and exits edit mode.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
For a complete list of props, see the Ark UI documentation.