Overview
This page documents the core form control components built with Radix UI primitives and styled with Tailwind CSS. All components include focus states, validation states, and dark mode support.Button
A versatile button component with multiple variants and sizes, built with@radix-ui/react-slot for composition.
Props
Visual style variant:
default- Primary button with solid backgrounddestructive- Destructive action (red)outline- Outlined button with bordersecondary- Secondary styleghost- Transparent with hover effectlink- Text link style with underline
"default"Button size:
default- 36px height (h-9)sm- 32px height (h-8)lg- 40px height (h-10)icon- Square 36px (size-9)icon-sm- Square 32px (size-8)icon-lg- Square 40px (size-10)
"default"When
true, renders as a Slot component allowing composition with other elements (e.g., Next.js Link)Default: falseAdditional CSS classes
<button> attributes.
Usage Examples
Basic Button
Button Sizes
Icon Buttons
Button with Icon
From TranscriptionForm (src/features/speech-to-text-playground/transcription-form.tsx:373)
Input
Text input field with focus and validation states.Props
Input type (text, password, email, number, file, etc.)Default:
"text"Additional CSS classes
<input> attributes.
Features
- Focus States: Blue ring on focus (
focus-visible:ring-ring/50) - Validation States: Red border and ring when
aria-invalidis set - Dark Mode: Semi-transparent background (
dark:bg-input/30) - File Input Support: Styled file input button
- Selection: Custom selection colors
Usage Examples
Text Input
Password Input
Number Input
File Input
Textarea
Multi-line text input with auto-resize support.Props
Additional CSS classes
<textarea> attributes.
Features
- Auto-resize: Uses
field-sizing-contentfor automatic height adjustment - Minimum Height: Default
min-h-16(64px) - Focus States: Same as Input component
- Validation States: Red border and ring when
aria-invalidis set
Usage Example
From TranscriptionForm (src/features/speech-to-text-playground/transcription-form.tsx:290):
Label
Accessible label component built with@radix-ui/react-label.
Props
Additional CSS classes
@radix-ui/react-label.
Features
- Accessibility: Proper label-input association
- Disabled States: Automatically styles when associated input is disabled
- Flex Layout: Default
flex items-center gap-2for icon support - Non-selectable: Uses
select-noneto prevent text selection
Usage Examples
Basic Label
Label with Checkbox
Checkbox
Checkbox component built with@radix-ui/react-checkbox.
Props
Controlled checked state
Callback fired when checked state changes
Disables the checkbox
Additional CSS classes
@radix-ui/react-checkbox.
Features
- Radix UI: Built on
@radix-ui/react-checkboxfor accessibility - Check Icon: Uses
lucide-reactCheck icon - States: Supports checked, unchecked, and indeterminate states
- Focus Ring: Visible focus indicator
Usage Example
From TranscriptionForm (src/features/speech-to-text-playground/transcription-form.tsx:312):
Select
Dropdown select component built with@radix-ui/react-select.
Components
The Select component is composed of multiple sub-components:- Select - Root component
- SelectTrigger - Button that opens the dropdown
- SelectValue - Displays selected value
- SelectContent - Dropdown container
- SelectItem - Individual option
Props
Select (Root)
Controlled selected value
Callback fired when selection changes
Disables the select
SelectTrigger
Trigger button size
default- 36px height (h-9)sm- 32px height (h-8)
"default"Additional CSS classes
SelectContent
Positioning strategyDefault:
"popper"Alignment relative to triggerDefault:
"center"Features
- Radix UI: Built on
@radix-ui/react-selectfor accessibility - Icons: Uses
lucide-reactchevron icons - Scroll Buttons: Automatic scroll indicators for long lists
- Animations: Smooth open/close animations
- Dark Mode: Styled for dark backgrounds
Usage Example
From TranscriptionForm (src/features/speech-to-text-playground/transcription-form.tsx:194):
Select with Icons
Styling
All form components use consistent styling patterns:Focus States
Validation States
Dark Mode
Disabled States
TypeScript Interfaces
Button Variants (from class-variance-authority)
Component Props
Radix UI Integration
These components integrate the following Radix UI primitives:- Button:
@radix-ui/react-slotfor composition - Label:
@radix-ui/react-labelfor accessibility - Checkbox:
@radix-ui/react-checkboxfor state management - Select:
@radix-ui/react-selectfor dropdown functionality
Why Radix UI?
- Accessibility: WAI-ARIA compliant components
- Unstyled: Full control over styling with Tailwind CSS
- Composable: Flexible component APIs
- Keyboard Navigation: Built-in keyboard support
Accessibility
- All form controls support proper label association
- Focus states are clearly visible
- Error states use
aria-invalidattribute - Keyboard navigation fully supported
- Screen reader friendly with proper ARIA attributes