- Accordion
- Alert Dialog
- Alert
- Autocomplete
- Avatar
- Badge
- Button Group
- Button
- Card
- Carousel
- Chart
- Checkbox
- Clipboard
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Editable
- Field
- File Upload
- Floating Panel
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- QR Code
- Radio Group
- Rating Group
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Spinner
- Splitter
- Steps
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle Group
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add @shark-ui/editable
Usage
import { Editable, EditableArea, EditableInput, EditablePreview, EditableControl, EditableCancelTrigger, EditableSubmitTrigger, EditableEditTrigger, } from "@/components/ui/editable";
<Editable defaultValue="Editable content"> <EditableArea> <EditableInput /> <EditablePreview /> </EditableArea> <EditableControl> <EditableCancelTrigger/> <EditableSubmitTrigger/> <EditableEditTrigger/> </EditableControl> </Editable>
Activation 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
You can change the size of the editable preview using the size prop on EditablePreview.
Extra Small
Small
Large
Extra Large
Examples
With Textarea
Without Controls
Edit without control buttons. Press Enter to save, Escape to cancel.
Controlled
Make the entire form editable at once by using the edit prop.
You can also use the value and onValueChange props to control the editable component.
Orientation
The orientation prop controls the layout of the editable component and its controls.
Horizontal
Controls are displayed horizontally next to the editable area. This is the default.
Vertical
Controls are displayed vertically next to the editable area. Useful for multi-line editable content.
API Reference
Editable
Root element of the editable component. Renders a div.
| Prop | Type | Default |
|---|---|---|
activationMode | focus | dblclick | click | none | 'focus' |
orientation | "horizontal" | "vertical" | "horizontal" |
submitMode | both | enter | blur | none | 'both' |
asChild | boolean | - |
className | string | - |
| Attributes | Type | Default |
|---|---|---|
[data-mode] | focus | dblclick | click | none | activationMode |
[data-orientation] | horizontal | vertical | orientation |
[data-slot] | - | editable |
EditableArea
Container for the editable input and preview. Renders a div.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableInput
Input element for editing. Renders an input or custom element when using asChild.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
| Attributes | Type | Default |
|---|---|---|
[data-slot] | - | editable-input |
EditablePreview
Preview element that displays the value when not editing. Renders a span.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
size | "xs" | "sm" | "md" | "lg" | "xl" | "md" |
className | string | - |
| Attributes | Type | Default |
|---|---|---|
[data-slot] | - | editable-preview |
EditableControl
Container for the control buttons. Renders a div.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableEditTrigger
Button that triggers edit mode. Renders a button.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableCancelTrigger
Button that cancels editing and reverts changes. Renders a button.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
EditableSubmitTrigger
Button that submits the edited value. Renders a button.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
For a complete list of props, see the Ark UI documentation.
On This Page