Skip to main content
Setting up gadget-ui involves three steps: configure the Tailwind preset, import global styles, and ensure content paths are correct.

Tailwind configuration

The gadget-ui preset extends Tailwind with design tokens mapped to CSS custom properties.

Add the preset

Import and apply gadgetPreset in your Tailwind config:
tailwind.config.js
The content array must include ./node_modules/@aurelienbbn/gadget-ui/dist/**/*.js. Without this, Tailwind will not detect component classes and styles will be missing.

What the preset provides

The preset extends Tailwind’s theme with:
  • Colors: Semantic tokens like accent, surface, foreground, destructive
  • Typography: font-sans (Inter) and font-mono (Inconsolata)
  • Border radius: radius, radius-sm, radius-lg, radius-full
  • Box shadows: shadow-button, shadow-card, shadow-raised
All values reference CSS custom properties defined in 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
This imports:
  • @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
If styles are missing in production, check that your content paths are correct. The gadget-ui dist folder must be included.

Framework-specific setup

tailwind.config.js
Import styles in app/globals.css:
app/globals.css

Verify setup

Create a test component to verify the setup:
src/Test.tsx
If the component renders with correct styles, your setup is complete.

Troubleshooting

Check that ./node_modules/@aurelienbbn/gadget-ui/dist/**/*.js is in your Tailwind content array. Without this, Tailwind cannot detect component classes.
Verify that @import "@aurelienbbn/gadget-ui/styles"; is in your main CSS file. The import loads Inter and Inconsolata via @fontsource.
Make sure the global styles import is placed before Tailwind directives (@tailwind base, etc.). The variables must be defined before Tailwind processes them.
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