The Editable Text component displays text that can be clicked to switch into edit mode, allowing inline editing.
Basic Usage
import { Editable } from "@paramanu/forms-react"
export default function App() {
<span>Click to edit</span>
<div class="pm-editable pm-editable--md" role="group">
<span>Click to edit</span>
Editing Mode
import { Editable } from "@paramanu/forms-react"
export default function App() {
<input defaultValue="Editing mode" />
<div class="pm-editable pm-editable--md pm-editable--editing" role="group">
<input class="pm-input pm-input--outline pm-input--md" value="Editing mode" />
Accessibility
| Feature | Detail |
|---|
role="group" | Container groups display and edit states |
aria-disabled | Applied when disabled is true |
| Keyboard | Enter confirms, Escape cancels edit |
Best Practices
- Provide visual indication of editability (underline, hover effect).
- Confirm or cancel edits with keyboard shortcuts.
Props
| Prop | Type | Default | Description |
|---|
size | "xs" | "sm" | "md" | "lg" | "md" | Text size |
disabled | boolean | false | Disabled state |
editing | boolean | false | Whether in edit mode |
CSS Classes
| Class | Description |
|---|
pm-editable | Base class |
pm-editable--editing | Editing state |
pm-editable--disabled | Disabled state |