Forms and selection · stable · MIT

Label

A native label with required, optional, disabled, and read-only cues.

Install editable source

Add Label

Base UI / canonicalnpx shadcn@latest add https://gummyui.dev/r/gummy-label.json

No package dependency beyond React. Shared Gummy material is resolved automatically.

Behavior contract

Semantics before surface

Semantics

A real label targets one form control.

Keyboard

Click moves focus through native label behavior.

System support

Light and dark themes, logical RTL layout, reduced motion, responsive content, and forwarded public refs.

Source-derived reference

Anatomy and public API

Exported anatomy

These public React parts are read directly from the canonical source during the documentation build.

  • GummyLabel

Prop contracts

GummyLabelProps

Composes React.LabelHTMLAttributes<HTMLLabelElement> & { required?: boolean; optional?: boolean; disabled?: boolean; readOnly?: boolean; meta?: React.ReactNode; }

Troubleshooting

Check behavior before surface.

Implementation decisions

When to use Label

Use a label to give a form control a persistent, programmatic name that remains visible while someone enters or reviews a value. Keep requirement and status text adjacent without duplicating the accessible name, and connect supplementary guidance through a description. Clicking the text should focus or toggle the intended control. Test repeated fields, dynamically generated identifiers, error summaries, long translations, nested groups, high zoom, and assistive-technology output before composing custom layouts.

Live product source

Inspect the canonical states

The Component Lab exercises real source across default, focus, disabled, responsive, dark, reduced-motion, and RTL contexts.

Open the live Component Lab

Interactive inspection

Try Label in context

Load the real component preview when you are ready to interact with its responsive, theme, and direction controls.

Editable source

Read before you install

Canonical Base UI or native source

The registry payload stays off the initial page request.