Skip to Content

Label

A brandless label element. No typography defaults are applied beyond inherit — the component renders with surrounding text styles until tokens are provided.

Usage

import { Label } from '@froglet/ui' // Associate via htmlFor <Label htmlFor="email">Email address</Label> <input id="email" type="email" /> // Wrap a control <Label> Email address <input id="email" type="email" /> </Label>

Props

PropTypeDescription
childrenReactNodeLabel text or content.
classNamestringAdditional CSS classes. Use to apply a token block.
htmlForstringID of the associated form control.
refReact.Ref<HTMLLabelElement>Forwarded to the underlying <label>.
...propsLabelHTMLAttributes<HTMLLabelElement>All standard label attributes.

CSS Custom Properties

TokenDefaultDescription
--label-font-familyinheritFont family.
--label-font-sizeinheritFont size.
--label-font-weightinheritFont weight.
--label-text-colorText color. Inherits surrounding color when unset.
--label-margin0Outer spacing.

Accessibility

  • <label> natively associates with a form control via htmlFor or by wrapping it.
  • Click on a label focuses or activates the associated control — no JavaScript needed.
Last updated on