If you answer yes, we store and analyse information that helps us improve the website. You can change your choice at any time at the bottom of the page. More about what we store and why.

We also store necessary information that cannot be opted out of. This makes the website work and keeps it secure.

Skip to main content

What are you looking for?

Try searching for…

Components

Label

Label functions as a clear and accessible text label that tells the user what an associated form element is about.

Press Enter to start editing
<label class="ds-label">Fødselsnummer (11 sifre)</label>
const Preview = () => {
  return <Label>Fødselsnummer (11 sifre)</Label>;
};

render(<Preview />)

Usage

Use the class name ds-label to style an HTML <label> element.

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.

No relevant data attributes found.

Example

Weights

Story not found: WeightsEn

React

Label

weight
Description

Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset @deprecated as field now automatically changes font-weight based on input type

Type
"regular" | "medium" | "semibold"
asChild
Description

Change the default rendered element for the one passed as a child, merging their props and behavior.

Type
boolean
Default
false
NameTypeDefaultDescription
weight"regular" | "medium" | "semibold"-

Adjusts font weight. Use this when you have a label hierarchy, such as checkboxes/radios in a fieldset @deprecated as field now automatically changes font-weight based on input type

asChildbooleanfalse

Change the default rendered element for the one passed as a child, merging their props and behavior.

Edit this page on github.com (opens in a new tab)