The heading component with optional editability. When editable is true, the heading 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 heading component.
- Type:
- JSX.
Element
// Controlled usage
const [heading, setHeading] = useState("Editable Heading");
<Heading tagName="h2" content={heading} editable onChange={setHeading} />
// Self-managed form usage
<form>
<Heading tagName="h2" content="Editable Heading" editable useHiddenInput name="heading" id="heading-1" />
<button type="submit">Submit</button>
</form>