Accessibility
Guidelines for automatic accessibility support via Radix Primitives and the Field system.
Focus Management
focus-visible:focus-ring for unified focus styling. Input / Textarea apply independent keyboard-detection-based control.
--color-focus-ring--color-focus-ring-error:focus-visible fires only on keyboard focus. The focus ring is not shown on mouse clicks. Input / Textarea additionally detect keyboard focus and display the ring only on Tab navigation.
Color Contrast
WCAG 2.2 AA requires minimum contrast ratios for text and UI components.
Text (normal)
Text (large)
18px+ / 14px bold+
UI elements
Text (enhanced)
Heading text
text-foreground on bg-background-muted
Action label
text-background on bg-foreground
Heading text
Low contrast — opacity-30
Heading text
Even lower contrast — opacity-40
Touch Targets
WCAG 2.5.8 recommends a minimum of 24px. The default size (40px) and above meets this. On desktop, smaller sizes are practical for mouse use.
Tips for better usability:
- • Ensure sufficient spacing between elements (8px or more)
- • Checkbox / Switch / RadioGroup can be toggled by clicking the label — the label area complements the touch target
- • Consider lg size or larger for mobile screens
Screen Reader
A list of ARIA attributes automatically managed by each component.
aria-busyAuto-applied when loading=truearia-pressedAuto-applied when selected=truedisabledNative disabled attribute (not aria-disabled)aria-labelRequired — no visible textManualaria-hiddenAuto-applied to inner SVG iconaria-invalidAuto-applied when error=truearia-describedbyAuto-connected to FieldError inside FieldroleAuto-set by Radix (checkbox / switch / radiogroup)aria-checkedAutomatically managed based on staterole="alert"Immediately announces error messages to screen readersaria-hidden="true"Auto-applied via Button leftIcon/rightIconWeb Guidelines
Accessibility best practices recommended broadly for the web, not just components.
Semantic HTML
- • Use appropriate elements like <button>, <nav>, <main>
- • Use <button> instead of <div onClick>
- • Mark up lists with <ul> / <ol>
Heading Hierarchy
- • Follow h1 → h2 → h3 order (don't skip levels)
- • Only one h1 per page
- • Headings become navigation points for screen readers
Landmarks
- • Use <header>, <footer>, <aside> to define page structure
- • Wrap main content in <main>
- • Enables screen readers to jump to different page sections
Alternative Text
- • Set alt attribute on all meaningful images
- • Use alt="" to hide decorative images
- • alt text should briefly describe the image content
Don't Rely on Color Alone
- • Combine color + icon + text for error indicators
- • Distinguish charts with patterns or labels
- • Differentiate links with underlines or icons, not just color
Dynamic Content
- • Use aria-live to notify screen readers of dynamic updates
- • Use role="alert" or role="status" for toasts and notifications
- • Manage focus appropriately on page transitions