@keboola/tailwind-config
v2.0.0
Published
Shared Tailwind CSS v4 design tokens for the Keboola UI platform — semantic color palette, type scale, radii and shadows as a `theme` object.
Readme
@keboola/tailwind-config
Shared Tailwind CSS design tokens for the Keboola UI platform — the same
semantic color palette, type scale, radii and shadows that
@keboola/design
is built on, shaped as a Tailwind theme object.
Use this when you want your Tailwind-styled app to inherit the platform's visual primitives — most relevant for audiences B (Keboola-branded external builders) and audience A (internal monorepo work). Audience C (customer- branded) typically supplies its own tokens; this package is optional then.
Install
npm install -D @keboola/tailwind-config tailwindcss@^4
# or
pnpm add -D @keboola/tailwind-config tailwindcss@^4Tailwind v3 is no longer supported — stay on @keboola/[email protected]
if you need it.
Use
The package exports tokens only: { theme }. Everything a v4 build owns in
CSS — the class prefix, the @imported layers, preflight, plugins — belongs in
your stylesheet, not in this object.
Load it through v4's @config bridge from your own tailwind.config.{js,ts}:
import keboolaConfig from '@keboola/tailwind-config';
export default {
theme: keboolaConfig.theme,
plugins: [
/* your own plugins */
],
};/* styles.css */
@import 'tailwindcss/theme.css' layer(theme) prefix(tw);
@import 'tailwindcss/utilities.css' layer(utilities) prefix(tw);
@config './tailwind.config.js';Class prefix (tw- in v3, tw: in v4)
@keboola/design components ship with prefixed class names baked into their
compiled JS, and those classes only render if a stylesheet the app loads
actually defines them. In v4 the prefix is declared in CSS
(prefix(tw) on the @import, producing tw:flex), not in this config — so
whether you can drop it depends on how you load design's stylesheet:
Build-from-source (the monorepo /
apps/boilerplatepattern) — the app imports the source stylesheet@keboola/design/stylesand runs its own Tailwind pass over design'sdist/plus its own markup. That pass emits the components' classes using your prefix, so droppingprefix(tw)renders design components UNSTYLED. Keep the prefix for build-from-source setups.Precompiled CSS — the app imports
@keboola/design/styles/compiled(the shippeddist/styles.css, which already contains every prefixed utility the components use, prebuilt). Design components are then styled by that stylesheet regardless of your own prefix, so authoring your utilities unprefixed is safe: design's classes and yours live in the same cascade without colliding.
Bottom line: prefix-less is safe only when you consume design via
/styles/compiled, not when you build design's utilities from source.
Subpath imports
If you only need the raw token data:
import colors from '@keboola/tailwind-config/colors';
import typography from '@keboola/tailwind-config/typography';Heads up —
colorsandtypographyare shipped as.tssource. Resolution works when the consumer loads the config through Tailwind (which uses jiti under the hood) or any bundler that's TypeScript-aware (Vite, esbuild, swc, tsx, ts-node via--loader). Plain Node ESM cannot load these files without a TS loader. A pre-compiled.jsvariant is planned — track or open an issue if your toolchain hits this.
Layout
index.js— the token entry ({ theme }); consumed viaimport(ESM).colors.ts— semantic palette (primary,background,foreground,muted,border,destructive, etc.) wired to the CSS variables shipped by@keboola/design.typography.ts— typography scale (used by the@tailwindcss/typographyplugin, which you install and register yourself).scrollFade.ts— optionalscroll-fadeutility plugin.
Plugins
Earlier versions bundled tailwindcss-animate, @tailwindcss/typography,
@tailwindcss/container-queries and tailwindcss-scoped-preflight and
registered them for you. They are gone: in v4 container queries are core,
animations come from tw-animate-css,
and preflight scoping is a @plugin directive in CSS. Register whatever you
still need in your own config — @keboola/design's
tailwind.config.js
and styles.css
are the reference setup.
License
MIT
