Wraps html text with some preset style options in a configurable tag container. When editable is true, the text becomes editable on focus, with accessibility and onChange support. Optionally, a hidden input can store the value for form submission.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props | object | Component props. Properties
| ||||||||||||||||||||||||||||||||||||||||||||||||
ref | object | | Ref to the component. |
- Since
- 1.1.15
- Source
The text component.
- Type:
- JSX.
Element
// Controlled usage
const [text, setText] = useState("Hello world");
<Text content={text} editable onChange={setText} />
// Self-managed form usage
<form>
<Text content="Hello world" editable useHiddenInput name="text-field" id="text-1" />
<button type="submit">Submit</button>
</form>