Back to Chakra Ui

Editable

apps/www/content/docs/components/editable.mdx

0.3.0-beta1.3 KB
Original Source
<ExampleTabs name="editable-basic" />

Usage

jsx
import { Editable } from "@chakra-ui/react"
jsx
<Editable.Root>
  <Editable.Preview />
  <Editable.Input />
</Editable.Root>

Examples

Double Click

Use the activationMode prop to make the content editable when users double click.

<ExampleTabs name="editable-with-double-click" />

Disabled

Use the disabled prop to disable the editable component.

<ExampleTabs name="editable-disabled" />

Textarea

You can make a text area editable.

<ExampleTabs name="editable-with-textarea" />

With Controls

Add controls such as "edit", "cancel" and "submit" to Editable for better user experience.

<ExampleTabs name="editable-with-controls" />

Controlled

Use the value and onValueChange props to control the editable component.

<ExampleTabs name="editable-controlled" />

Store

An alternative way to control the editable component is to use the RootProvider component and the useEditable store hook.

This way you can access the editable state and methods from outside the editable.

<ExampleTabs name="editable-with-store" />

Props

Root

<PropTable component="Editable" part="Root" />

Explorer

Explore the Editable component parts interactively. Click on parts in the sidebar to highlight them in the preview.

<Explorer name="editable-explorer-demo" />