Label

Renders an accessible label associated with controls.

Overview

The Label component provides accessible, semantic labeling for form controls, automatically associating with form elements through the htmlFor prop to improve usability and screen reader support. Built on Radix UI, it features customizable sizes, orientation options, and flexible styling powered by class-variance-authority.

Usage

import { Label } from "@tilt-legal/cubitt-components/primitives";
<Label htmlFor="email">Your email address</Label>

Examples

With input

With switch

Sizes

Orientations

With Select

With Textarea

Props

Label

PropTypeDescription
htmlForstringThe id of the form control this label is associated with
size"xs" | "sm" | "default" | "lg"The size of the label text and spacing
orientation"vertical" | "horizontal"Layout direction for label content
classNamestringAdditional CSS classes to apply to the label
childrenReact.ReactNodeThe content of the label
...propsReact.ComponentProps<typeof RadixLabel.Root>All other Radix label props

LabelDescription

Size-aware helper text rendered under the main label.

PropTypeDescription
size"xs" | "sm" | "default" | "lg"Matches the parent label/control size
classNamestringAdditional CSS classes
childrenReact.ReactNodeDescription content

Design Guidelines

Accessibility and association

  • Always associate labels with form controls using the htmlFor prop that matches the control's id
  • Use descriptive text that clearly explains what the associated control is for
  • Avoid placeholder-only forms - labels should always be visible, not just placeholder text
  • Use sentence case rather than title case for better readability

Layout and positioning

  • Use vertical orientation for traditional form fields (inputs, selects, textareas) to improve scanability
  • Use horizontal orientation for checkboxes, radio buttons, and switches to maintain natural reading flow
  • Use consistent spacing between labels and their associated controls - the component handles appropriate gap sizes automatically
  • Align labels left for better readability in forms

Sizing

  • Use consistent sizes throughout your form for visual hierarchy
  • Match label size with the associated form control size when possible
  • Use smaller sizes (xs, sm) for compact forms or secondary information
  • Use larger sizes (lg) for prominent form fields or headings

Best practices

  • Prefer htmlFor association over wrapping form controls when possible for cleaner markup
  • Use wrapping pattern with orientation prop when you need the label to contain multiple elements
  • Maintain semantic meaning - labels should always describe the purpose of their associated control

On this page