WhetInput supports a comprehensive theming system that allows you to match your application’s design perfectly. You can use predefined themes, follow system preferences, or create completely custom themes with your own design tokens.
// Inherits theme from parent context<WhetInput appearance="inherit" ... />// Or explicitly set to follow system preference<WhetInput theme="auto" ... />
interface ThemeTokens { // Color tokens primary?: string; // Primary accent color secondary?: string; // Secondary accent color background?: string; // Background color surface?: string; // Surface color for panels text?: string; // Primary text color textSecondary?: string; // Secondary text color border?: string; // Border color borderHover?: string; // Border color on hover focus?: string; // Focus ring color // State colors success?: string; // Success state color warning?: string; // Warning state color error?: string; // Error state color info?: string; // Info state color // Interactive states hover?: string; // Hover state color active?: string; // Active state color disabled?: string; // Disabled state color // Layout tokens borderRadius?: string; // Border radius focusRingThickness?: string; // Focus ring thickness nudgePanelGap?: string; // Gap between nudge panel and input nudgePanelZIndex?: number; // Z-index for nudge panel nudgePanelShadow?: string; // Shadow for nudge panel nudgeChipPadding?: string; // Padding for nudge chips nudgeChipGap?: string; // Gap between nudge chips}
Use inherit for most cases to respect user preferences - Use light or
dark when you need consistent branding - Use tokens for complete design
system integration - Use auto to follow system preferences automatically
Design Token Guidelines
Keep color contrast ratios accessible (WCAG AA minimum) - Use semantic color
names (primary, success, error) - Test themes in both light and dark
environments - Consider hover and focus states for interactive elements
Performance Considerations
Avoid changing theme tokens frequently - Use CSS custom properties for
global theme changes - Consider using ThemeProvider for app-wide theming -
Test theme switching performance on mobile devices