Editable

Editable is a component used to obtain inline editable text input.

なんとかなれーッ!

Usage

import { Editable } from "@yamada-ui/react"
<Editable.Root>
  <Editable.Preview />
  <Editable.Input />
  <Editable.Textarea />
  <Editable.Control>
    <Editable.EditTrigger />
    <Editable.SubmitTrigger />
    <Editable.CancelTrigger />
  </Editable.Control>
</Editable.Root>

Use Textarea

To enable multiple lines, use Editable.Textarea.

おやつ…って事!? それって最高じゃん!!

Make Edit Mode Default

To make edit mode default, set startWithEditView to true.

Disable Submit on Blur

To prevent submitting changes when focus is lost, set submitOnBlur to false.

なんとかなれーッ!

Disable Text Selection on Focus

To prevent text selection when focused, set selectAllOnFocus to false.

なんとかなれーッ!

Change Border Color

To change the border color, set a color to focusBorderColor or errorBorderColor.

Custom focus border color
Custom error border color

Disable

To disable, set disabled to true.

Your email address
Your email address
We'll never share your email.

Read-Only

To read-only, set readOnly to true.

Your email address
Your email address
We'll never share your email.

Invalid

To make the input invalid, set invalid to true.

Your email address
Your email address
We'll never share your email.

Control

なんとかなれーッ!

Control

なんとかなれーッ!

Props

Accessibility

If you are not using Field.Root, set aria-label or aria-labelledby to Editable.Root.

<Editable.Root defaultValue="なんとかなれーッ!" aria-label="Feedback">
  <Editable.Preview />
  <Editable.Input />
</Editable.Root>
<VStack gap="sm">
  <Text as="h3" id="label">
    Feedback
  </Text>

  <Editable.Root defaultValue="なんとかなれーッ!" aria-labelledby="label">
    <Editable.Preview />
    <Editable.Input />
  </Editable.Root>
</VStack>

Keyboard Navigation

KeyDescriptionState
EnterSubmits the edit for Editable.Input.-
EscapeCancels the edit mode.-

ARIA Roles and Attributes

ComponentRole and AttributesUsage
Editable.Inputaria-describedbyIf Editable.Root is within a Field.Root and Field.Root has an errorMessage, helperMessage, or a Field.ErrorMessage, Field.HelperMessage, sets its id.
aria-disabledSet to "true" if disabled is set.
aria-invalidSet to "true" if invalid is set.
aria-readonlySet to "true" if readOnly is set.
aria-requiredSet to "true" if required is set.
Editable.Textareaaria-describedbyIf Editable.Root is within a Field.Root and Field.Root has an errorMessage, helperMessage, or a Field.ErrorMessage, Field.HelperMessage, sets its id.
aria-disabledSet to "true" if disabled is set.
aria-invalidSet to "true" if invalid is set.
aria-readonlySet to "true" if readOnly is set.
aria-requiredSet to "true" if required is set.
Editable.Controlrole="group"Indicates that this is a group.