Headless Design
Components ship with:- No default styles - You decide how components look
- Structural markup - Semantic HTML with proper accessibility
- Data attributes - Hooks for CSS targeting
- ClassName support - Standard React className prop on all components
- Zero CSS conflicts with your existing styles
- Complete design system flexibility
- Smaller bundle sizes (no unused CSS)
- Framework-agnostic styling approach
Using with Tailwind CSS
Zayne Labs UI is designed to work seamlessly with Tailwind CSS.1. Import the Preset
The library includes a Tailwind preset with theme tokens and utilities:style.css
- Theme variables - Color tokens like
zu-foreground,zu-primary,zu-accent - Animations - Pre-configured transitions and keyframes
- Utilities - Helper classes for common patterns
2. Theme Tokens
The preset defines CSS custom properties for theming:theme.css
.dark class or data-theme="dark".
3. Apply Tailwind Classes
Use theclassName prop to style components:
Default Styles Example
Some components include minimal defaults that use Tailwind’s merge utility:card.tsx
cnMerge utility (wraps tailwind-merge) lets you override defaults:
Using Without Tailwind
You can style components using vanilla CSS by targeting data attributes.Target Data Attributes
Every component rendersdata-scope, data-part, and data-slot attributes:
styles.css
Carousel Styling Example
carousel.css
ClassName Prop Usage
All components accept aclassName prop for custom styles:
Advanced: Custom Class Name Utilities
Many components accept aclassNames prop for granular control:
carousel.tsx
Best Practices
Use Design Tokens
Use Design Tokens
Leverage the built-in theme tokens (
zu-primary, zu-foreground, etc.) for consistency and automatic dark mode support.Prefer Data Attributes for Global Styles
Prefer Data Attributes for Global Styles
Use data attributes in your global CSS for base component styles, and className for instance-specific customization.
Organize Your Styles
Organize Your Styles
For Tailwind projects:
- Keep component-specific utilities in your component files
- Extract repeated patterns into custom Tailwind utilities
- Use the
@layerdirective for organization
- Create separate CSS files per component
- Use CSS custom properties for theming
- Follow BEM or a similar naming convention alongside data attributes
Next Steps
Component Structure
Learn about the compound component pattern
TypeScript
Explore type-safe component APIs