Overview
@kuzenbo/styles provides optional baseline global CSS that enhances the default browser experience while maintaining semantic token compatibility. It includes polished focus indicators, smooth scrollbars, accessible text selection, and motion-aware animations.
Installation
@kuzenbo/styles has no React runtime dependency. It’s a pure CSS package that works with any framework.Quick start
Import the baseline styles alongside your theme:app/layout.tsx
What’s included
The baseline stylesheet provides seven key improvements:Focus indicators
Kuzenbo uses:focus-visible for accessible, non-intrusive focus rings:
Browser compatibility fallback
For browsers without:focus-visible support:
High-contrast mode
Automatic adaptation for forced-colors mode:Scrollbar styling
Kuzenbo provides thin, theme-aware scrollbars that adapt to your color scheme.Firefox scrollbars
WebKit scrollbars
Responsive behavior
On touch devices, scrollbars expand for better usability:Text selection
High-contrast text selection using semantic primary tokens:Custom selection colors
Override selection colors globally or per component:Motion preferences
Kuzenbo respects user motion preferences for smooth scrolling:Enable smooth scroll
Disable for reduced motion
Disable during scroll lock
When modals or drawers lock scroll:Anchor offset configuration
The--kb-anchor-offset variable ensures hash links and focus targets aren’t hidden behind sticky headers.
Default value
With sticky header
Example usage
Root element defaults
Kuzenbo sets sensible root defaults for a polished baseline:Text wrapping
Prevents layout breakage from long URLs, tokens, and code:Link underlines
Improved readability for underlined links:Border and outline tokens
Global border and outline alignment:This uses
@layer base to ensure low specificity and easy overrides.Customization examples
Brand selection colors
Larger scrollbars
Custom focus ring style
Disable smooth scroll globally
Opting out
The baseline styles are entirely optional. If you prefer to start from scratch:- Don’t import
@kuzenbo/styles/recommended.css - Import only your theme:
@kuzenbo/theme/prebuilt/kuzenbo.css - Add your own global styles as needed
Integration with Tailwind
The baseline styles work seamlessly with Tailwind CSS:globals.css
Accessibility considerations
Focus-visible vs focus
Focus-visible vs focus
The baseline uses
:focus-visible to show focus rings only for keyboard navigation, not mouse clicks. This improves UX while maintaining accessibility.High-contrast mode support
High-contrast mode support
In forced-colors mode (Windows High Contrast), focus rings automatically use the system Highlight color for maximum visibility.
Motion sensitivity
Motion sensitivity
Smooth scrolling is disabled for users who prefer reduced motion, respecting their system preferences.
Color contrast
Color contrast
Text selection uses high-contrast primary tokens (default APCA 75+) for readability across themes.
Best practices
Import order
Import order
Always import in this order:
- Theme CSS (
@kuzenbo/theme/prebuilt/*.css) - Baseline styles (
@kuzenbo/styles/recommended.css) - Tailwind layers (if using Tailwind)
- Custom global styles
Token-based overrides
Token-based overrides
Use CSS variables to customize behavior instead of overriding rules:
Responsive considerations
Responsive considerations
The baseline automatically adapts scrollbars and other features based on pointer type (fine vs coarse). Test on both desktop and mobile devices.
Related documentation
Theme runtime
Learn about Kuzenbo’s theme system and dark mode support.