Label
<Label />TailwindCSS ModulesProduction StableAccessible, foundational form label primitive engineered on Radix UI Label. Integrates automatic semantic required asterisks, optionality badges, helper tooltips, disabled sync, and strict baseline typography alignment across all Coloxo control heights.
npx coloxo add label --style coloxo-cssimport { Label } from '@coloxo/ui';@coloxo/uiBundle: 0.58 KBDesign Tokens:
01 / Visual architecture
1. Indicator & Marker Architecture
Labels communicate validation expectations immediately before input engagement. Coloxo UI standardizes required asterisks, optional annotations, contextual helpers, and disabled synchronization.
Standard Neutral<Label htmlFor="user">Username</Label>
Required Marker<Label htmlFor="email" required>Email Address</Label>
Optional Marker<Label htmlFor="org" optional>Organization Name</Label>
Contextual Helper<Label required tooltip="…">Tax ID</Label>
Disabled State<Label htmlFor="prefix" disabled>Prefix</Label>
Inline Metadata Tag<Label required>TLS Cert <Badge>RSA 4096</Badge></Label>
02 / Geometric rhythms
2. Semantic Alignment & Control Sizing
Optical parity across high-density enterprise software requires strict alignment between Label scale and paired Form Control height. Coloxo enforces a 6px baseline gap token across default control variants.
| Size tier | Control height | Label typography | Vertical gap | Live optical specimen |
|---|---|---|---|---|
| xs | 32px | 12px / 16px LH --cx-label-xs | gap-1 (4px) | |
| sm | 36px | 13px / 18px LH --cx-label-sm | gap-1.5 (6px) | |
| md · Standard | 40px | 14px / 20px LH --cx-label-md | gap-1.5 (6px) | |
| lg | 44px | 15px / 22px LH --cx-label-lg | gap-2 (8px) | |
| xl | 48px | 16px / 24px LH --cx-label-xl | gap-2 (8px) |
03 / DOM architecture
3. Radix UI Primitive & A11Y Contract
Coloxo Label wraps Radix UI's @radix-ui/react-label, guaranteeing synthetic event forwarding to non-native controls, selection prevention, and standard keyboard delegation.
Rendered DOM element tree
Automatic ARIA synchronization ensures that double-clicking text never causes accidental browser highlights, while maintaining native programmatic focus transfer.
React canonical pattern
Standard implementation binding native text inputs, Radix Select primitives, and checkbox tiles. Defaults: required=false, optional=false, user-select: none.
04 / Sandbox workspace
4. Interactive Live Playground
Configure label attributes, toggle state variations, and evaluate the rendered markup in real-time.
Props inspector
<Label htmlFor="demo-target" required tooltip="Helper guidance"> Corporate Email Address</Label>05 / Theme system
5. Enterprise Dark Theme Matrix
In zero-light developer workstation environments, Coloxo UI transitions the label baseline to high-emittance Slate-100 and elevates the required asterisk contrast to 7.2:1 against the #0B1120 bedrock.
Color: #F1F5F9 (Slate-100)Primary IAM Role
Asterisk: #EF4444 (7.2:1 Ratio)Required specimen
Optional: #94A3B8 (Slate-400)Optional specimen
06 / Application patterns
6. Enterprise Form Compositions
Complete reference implementations illustrating how Label harmonizes across high-density administrative portals, compliance workflows, and mission-critical payment configurations.
SSO Operator Provisioning
Federated Active Directory Link
Settlement Account Configuration
Fedwire & SWIFT Network Protocols
07 / Compliance & standards
7. A11Y & Screen Reader Contract
Every Coloxo Form Label undergoes automated testing with screen readers (NVDA, JAWS, VoiceOver) to prevent redundant spoken punctuation and guarantee WCAG 2.1 AA and AAA standard parity.
Label utilizes synthetic event delegation. Clicking the label forwards immediate programmatic focus to linked inputs without triggering text selection or false double-tap zooms on mobile touch viewports.
The red asterisk is rendered inside aria-hidden="true". Screen readers will not announce the literal string "star", relying instead on the paired input's aria-required="true".
Fixed line-heights and a strict 6px bottom margin ensure that swapping an input from default to required or error never produces Cumulative Layout Shift (CLS score: 0.000).
Props
| Name | Type | Default | Description |
|---|---|---|---|
| htmlFor | string | — | Associates the label with a control id. |
| size | "xs" | "sm" | "md" | "lg" | "xl" | md | Typography scale aligned to paired control heights (12/16–16/24). |
| required | boolean | — | Shows a red required asterisk (aria-hidden). |
| optional | boolean | — | Shows muted (optional) when not required. |
| disabled | boolean | — | Demotes contrast when the paired control is disabled. |
| tooltip | ReactNode | — | Inline helper tooltip via trailing info icon. |
| tooltipSupportingText | ReactNode | — | Optional supporting line under tooltip title. |
| children | ReactNode | — | Label text; may nest Badge or other inline metadata. |