docs/components/editable
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Allows user to edit text in-place.
PreviewCode
Edit user
Click in the field or edit button to start editing
Name
Vinicius Vicentini
Username
@vinihvc
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/editable
Editable
├── EditableArea
│ ├── EditablePreview
│ └── EditableInput
└── EditableControl
├── EditableEditTrigger
├── EditableCancelTrigger
└── EditableSubmitTrigger
import {
Editable,
EditableArea,
EditableInput,
EditablePreview,
EditableControl,
EditableCancelTrigger,
EditableSubmitTrigger,
EditableEditTrigger,
} from "@/components/ui/editable";
<Editable>
<EditableArea>
<EditableInput />
<EditablePreview />
</EditableArea>
<EditableControl>
<EditableCancelTrigger/>
<EditableSubmitTrigger/>
<EditableEditTrigger/>
</EditableControl>
</Editable>
Make the entire form editable at once by using the edit prop.
The value and onValueChange props control the editable component programmatically.
PreviewCode
Edit user
Click the edit button to start editing
Edit
Name
Vinicius Vicentini
Username
@vinihvc
The activationMode prop controls how editing is triggered.
Editing starts when the field receives focus.
PreviewCode
Edit with focus
Focus the field to start editing (default activation mode)
Name
Vinicius Vicentini
Username
@vinihvc
Editing starts with a single click on the preview.
PreviewCode
Edit with click
Click the text to start editing
Name
Vinicius Vicentini
Username
@vinihvc
Editing starts with a double-click on the preview.
PreviewCode
Edit with double-click
Double-click the text to start editing
Name
Vinicius Vicentini
Username
@vinihvc
No automatic activation. Use EditableEditTrigger to manually start editing.
PreviewCode
Edit with manual trigger
Use the edit button to start editing (no automatic activation)
Name
Vinicius Vicentini
Username
@vinihvc
The size prop on EditablePreview controls the preview dimensions.
PreviewCode
Editable content
PreviewCode
Editable content
The orientation prop controls the layout of the editable component and its controls.
PreviewCode
Editable content
PreviewCode
Editable contentEditable content
PreviewCode
Edit description
Double-click the text to start editing
Description
This is a longer description that can be edited. Click to edit and make changes.This is a longer description that can be edited. Click to edit and make changes.
Edit without control buttons. Press Enter to save, Escape to cancel.
PreviewCode
Edit without controls
Click the field to edit, press Enter to save, Escape to cancel
Name
Vinicius Vicentini
Root component. Manages edit mode and value.
| Prop | Type | Default |
|---|---|---|
activationMode | `focus | dblclick |
orientation | `"horizontal" | "vertical"` |
submitMode | `both | enter |
asChild | boolean | - |
className | string | - |
Wraps the input and preview views.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
Input shown when editing. Use asChild for custom input elements.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
Shows the value when not editing. Click to enter edit mode.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
size | `"xs" | "sm" |
className | string | - |
Holds edit/cancel/submit control buttons.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
Enters edit mode on click.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
Cancels editing and reverts to previous value.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | - |
className | string | - |
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.
[
Previous page
Drawer ](/docs/components/drawer)[
Next page
Field ](/docs/components/field)
On This Page
InstallationAnatomyUsageControlledModesFocusClickDouble-ClickNoneSizesSmallLargeOrientationHorizontalVerticalExamplesWith TextareaWithout ControlsAPI ReferenceEditableEditableAreaEditableInputEditablePreviewEditableControlEditableEditTriggerEditableCancelTriggerEditableSubmitTrigger