Skip to main content
ai-tool-elements ships a bundled CSS file built with Tailwind CSS v4. Importing it once sets up all the card styles. You can override or extend those styles with your own Tailwind utility classes via the className prop, or by redefining the underlying CSS custom properties that the card components rely on.

Importing the bundled styles

The bundled stylesheet must be imported once in your application’s entry point before any ToolCard is rendered. Without it, the cards will have no default visual styles.
Next.js — add to app/layout.tsx:
Vite — add to src/main.tsx:

Overriding styles with className

ToolCard forwards all props it does not consume directly to the underlying Card element, including className. Any Tailwind utilities or custom classes you pass are merged on top of the default card styles using tailwind-merge, so conflicting utilities resolve predictably.
Because the library uses tailwind-merge internally, passing a utility that targets the same property as a built-in class (e.g. a different border color) will correctly override it rather than producing duplicate declarations.

CSS custom properties

The card’s colors are driven by four CSS custom properties that map to shadcn/ui design tokens. You can redefine them at :root or at any parent scope to change the palette for all cards in that subtree:
The bundled stylesheet declares sensible light-mode defaults for all four variables, so overriding only the ones you need is sufficient.

Dark mode

The bundled styles.css only declares light-mode defaults for the four CSS custom properties — it does not include a built-in dark-mode block. To support dark mode in your application, redefine the variables under your dark-mode selector or media query in your own stylesheet:
Because all card colors are driven by these four CSS custom properties, a single override block covers every ToolCard on the page.

Card dimensions

ToolCard is fluid by default — it stretches to fill the width of its containing block. To control layout, wrap cards in a grid or flexbox container:
Use max-w-sm or similar on individual cards when you need a fixed maximum width without a grid.
The library uses Tailwind CSS v4 internally. If your app also uses Tailwind, the bundled CSS and your app’s CSS coexist without conflict because both compile to standard CSS — there is no shared runtime or global state between the two Tailwind instances.