Tailwind configuration
The gadget-ui preset extends Tailwind with design tokens mapped to CSS custom properties.Add the preset
Import and applygadgetPreset in your Tailwind config:
tailwind.config.js
What the preset provides
The preset extends Tailwind’s theme with:- Colors: Semantic tokens like
accent,surface,foreground,destructive - Typography:
font-sans(Inter) andfont-mono(Inconsolata) - Border radius:
radius,radius-sm,radius-lg,radius-full - Box shadows:
shadow-button,shadow-card,shadow-raised
globals.css, so they respond to theme changes automatically.
Preset source code
Here is the actual preset implementation:tailwind-preset.ts
Using design tokens
Once configured, use tokens in your Tailwind classes:Global styles
Import the global CSS file to load fonts and define CSS variables.Import in your main CSS
Add this to your root CSS file:styles/globals.css
@fontsource-variable/inter(variable font)@fontsource/inconsolata(400 and 700 weights)- CSS custom properties for colors, shadows, radius, and fonts
- Dark and light theme definitions
What gets loaded
Here is an excerpt from the global styles:globals.css (excerpt)
Content paths
Tailwind scans your source files to detect which classes to include. You must specify both your project files and the gadget-ui dist folder.Correct content configuration
tailwind.config.js
Framework-specific setup
- Next.js
- Vite
- Astro
tailwind.config.js
app/globals.css:app/globals.css
Verify setup
Create a test component to verify the setup:src/Test.tsx
Troubleshooting
Missing styles in production
Missing styles in production
Check that
./node_modules/@aurelienbbn/gadget-ui/dist/**/*.js is in your Tailwind content array. Without this, Tailwind cannot detect component classes.Fonts not loading
Fonts not loading
Verify that
@import "@aurelienbbn/gadget-ui/styles"; is in your main CSS file. The import loads Inter and Inconsolata via @fontsource.CSS variables not defined
CSS variables not defined
Make sure the global styles import is placed before Tailwind directives (
@tailwind base, etc.). The variables must be defined before Tailwind processes them.TypeScript errors on imports
TypeScript errors on imports
If you see module resolution errors, check that your tsconfig includes
"moduleResolution": "bundler" or "node16". The package uses modern exports.Next steps
Theming
Explore design tokens, color system, and theme switching
Components
Browse available components and variants
