Inputs already have the description built in — the
descriptionprop of CdsTextInput and the other controls. A standaloneCdsDescriptionis needed for groups of fields and for your own controls. For the label of a field take CdsLabel, for the messages under a field take CdsMessages.
Variations
Text
The text prop sets the content. The default slot adds arbitrary markup to it — a highlighted input format, for example.
Tag
By default the description renders as a div tag. The tag prop changes the tag — to p, for example, when the description lives inside the text of the page.
Scenarios
An explanation for a group of fields
A group of checkboxes has no description of its own, so the label and the explanation are assembled by hand: CdsLabel names the group, CdsDescription explains what to pick.
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
content | string | number | undefined | — | Content displayed in the component. |
tag | string | JSXComponent<any> | undefined | 'div' | Custom HTML tag or component to render |
text | string | number | undefined | — | Text displayed in the component. |
Slots
| Name | Type | Description |
|---|---|---|
default | any | Text of the description |