FormControl
FormControl
Section titled “FormControl”Form control wrapper component with theme-aware styling that handles input focus and validation
Uses CSS custom properties from @sparkle/theme for consistent theming across light/dark modes. Primarily a pass-through wrapper for Radix Form.Control.
Import
Section titled “Import”import { FormControl } from '@sparkle/ui'| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
asChild | boolean | undefined | “ | Use the child component as the control element | |
size | "sm" | "md" | "lg" | undefined | “ | Size variant for the control | |
validationState | "default" | "success" | "error" | undefined | “ | Validation state for styling | |
disabled | boolean | undefined | “ | Whether the control is disabled |
Theme Integration
Section titled “Theme Integration”This component uses CSS custom properties from @sparkle/theme for consistent styling across light and dark modes.
Design Tokens Used
Section titled “Design Tokens Used”--theme-*: Uses theme design tokens for consistent styling
You can customize the appearance by:
- Theme Variables: Modify theme tokens in your
@sparkle/themeconfiguration - CSS Classes: Apply custom CSS classes via the
classNameprop - CSS-in-JS: Use styled-components or emotion with the component
Accessibility
Section titled “Accessibility”This component follows accessibility best practices with proper ARIA attributes and keyboard support.
Related Components
Section titled “Related Components”- Form
- FormDescription
- FormField
- FormInput
- FormLabel
- FormMessage
- FormPassword
- FormSelect
- FormSelectItem
- FormSubmit
- FormTextarea