Components
Label
Label functions as a clear and accessible text label that tells the user what an associated form element is about.
HTML
Unable to parse html
const Preview = () => { return <Label>Fødselsnummer (11 sifre)</Label>; }; render(<Preview />)
Usage
Use the class name ds-label to style an HTML <label> element.
Use data-weight to set the font weight.
CSS variables and data attributes
Sizes are controlled with data-size and colors with data-color. The component will inherit from the closest parent where these are set.
No relevant css variables found.
| Name | Value |
|---|---|
| data-weight | semibold, regular |
Example
Weights
React
- weight
- Description
Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset
- Type
"regular" | "medium" | "semibold"- Default
medium
- asChild
- Description
Change the default rendered element for the one passed as a child, merging their props and behavior.
- Type
boolean- Default
false
| Name | Type | Default | Description |
|---|---|---|---|
| weight | "regular" | "medium" | "semibold" | medium | Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset |
| asChild | boolean | false | Change the default rendered element for the one passed as a child, merging their props and behavior. |