--- title: Label description: Labels name form controls so users and assistive technologies know what data to enter. category: Forms --- import { meta as LabelMeta, Default } from '@/content/stories/label'; import Canvas from '@/components/component-docs/canvas'; import Demo from '@/components/component-docs/demo'; export const config = { dependencies: { components: [Canvas, Demo], scripts: [ '../../components/component-docs/demo.script.tsx', '../../components/component-docs/canvas.script.tsx', '../../components/component-docs/controls.script.tsx', ], }, }; # Label
Labels name form controls so users and assistive technologies know what data to enter.
## Try itLabels should remain visible when the field is focused. Do not rely on placeholder text as a label replacement.
## Theming Label text maps to the **`on-background`** role, never a palette step: | Part | CSS roles | | --- | --- | | Root | `on-background`, `font-medium`, `--text-control` size | Override at the theme layer, not in component CSS. ## Accessibility - Labels are linked to controls via `for` / `id` wiring inside `RuiField`. - Write labels as nouns or short phrases, such as "Email address", not "Enter your email". - Required fields should indicate requirement in the label or with adjacent text, not color alone. ## API `RuiLabel` is a presentational JSX view over a native `