Interaction states
For consistency and lower cognitive load components should look and behave in similar ways. There is a set of states that all components should support.
Focus
Interactive components should support keyboard focus, that is to say when users navigate to the component using the keyboard the component should indicate that it currently has the keyboard focus.
Standard browser elements like links and buttons already support this with a standard ‘outline’; to keep our theme consistent we override the default with our own outline. The same outline must be used for Funnel components.
Our focus outline:
- is a 2px ring
- with 1px offset
- for light mode,
primary-200 - for dark mode,
primary-800
We have a utility (fun-outline) to make this easy:
In practice you will want to apply the outline only when the element has keyboard focus. Use the focus-visible modifier for this:
Best practices
State hierarchy
When multiple states could apply, follow this priority order:
- Disabled - Overrides all other states
- Selected - Takes precedence over default and hover
- Focus - Can combine with selected
- Hover - Only applies when not disabled
- Default - Base state
Accessibility considerations
- Always provide focus states for keyboard navigation
- Use
focus-visibleto show focus only when needed - Ensure sufficient color contrast in all states
- Test with screen readers to verify state announcements
Implementation tips
- Use CSS custom properties for consistent state styling
- Leverage Tailwind’s state modifiers (
hover:,focus:,disabled:) - Test states across different themes (light/dark mode)
- Consider reduced motion preferences for animations