Unofficial
Internal
Components
Label
Internal
A label for a form field.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| id | string | - | 'id' attribute to place on the base HTML element |
| classBlock | string | - | Block name override in BEM style classes applied to all elements |
| classModifiers | Modifiers | - | BEM style modifiers to apply to the base HTML element |
| className | string | - | Extra classes to apply to the base HTML element |
| heading | ElementType | - | Component to wrap the label in, making it a heading |
Stories
Standard
A standard Label.
In-line
Heading
Where the question is a heading, give heading the component to wrap the
label in. The heading goes around the label rather than inside it, which would
not be valid HTML.
The label is sized to match the level, following the hierarchy GOV.UK uses on
a page that is not long form content: large for an <h1>, medium for an
<h2>, small below that. Say so with classModifiers to size it otherwise,
and do say so if you pass a component we cannot read a level from.