EditableText
Basic
Lorem ipsum dolor...
<EditableText
text={basicExampleText}
onChange={(newText) => {
setBasicExampleText(newText);
}}
/>
Textarea
Lorem ipsum dolor...
<EditableText
text={textareaExampleText}
onChange={(newText) => {
setTextareaExampleText(newText);
}}
/>
Empty state with placeholder
Empty state text
<EditableText
emptyStateText="Empty state text"
text={emptyStateExampleText}
onChange={(newText) => {
if (newText.length > 0) {
setEmptyStateExampleText(newText);
}
}}
inputProps={{ placeholder: "Placeholder text..." }}
/>
...rest
Whatever you pass to
...rest
will get passed to Text
, Input
, and Textarea
. If instead you want to pass props to only one of those three components, you can use textProps
, inputProps
, or textareaProps
.Lorem ipsum dolor...
<EditableText
text={restExampleText}
onChange={(newText) => {
setRestExampleText(newText);
}}
className="text-supporting-green-500"
/>
Props
Prop | Required | Default | Type and notes |
---|---|---|---|
text | - |
| |
onChange | - |
| |
type | - | "input" |
|
emptyStateText | - | - |
|
textProps | - | - |
Gets passed to Text . |
inputProps | - | - |
Gets passed to Input . |
textareaProps | - | - |
Gets passed to Textarea . |
...rest | - | - |
Whatever you pass to ...rest will get passed to Text , Input , and Textarea . If instead you want to pass props to only one of those three components, you can use textProps , inputProps , or textareaProps . |