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, and a button can copy content to the clipboard inline.
| 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
// With copy button inline, non-editable
<Text content="Copy Me" showCopyButton />
// Controlled usage with copy button inline
const [text, setText] = useState("Hello world");
<Text content={text} editable onChange={setText} showCopyButton />
// Self-managed form usage with copy button inline
<form>
<Text content="Hello world" editable useHiddenInput name="text-field" id="text-1" showCopyButton />
<button type="submit">Submit</button>
</form>