Kesko CSS framework ships the full set of the CSS custom properties, Skatta Sans UI typeface, and Tailwind-style utility classes, with optional component classes as an add-on.
Installation #
To install the CSS framework as a dependency in your project, run:
npm install @kesko/csspnpm add @kesko/cssyarn add @kesko/cssbun add @kesko/cssUsage #
Import the base stylesheet into your project:
@import "@kesko/css/dist/kesko.min.css";This gives you:
- All
--k-*custom properties on:root @font-facedeclarations for SkattaSansUI (woff2 + woff)- Utility classes for colors, typography, spacing, borders, radius, and shadows
Component classes (optional) #
The component classes that mirror @kesko/components ship as a separate stylesheet. Load it when you need those components in plain HTML:
@import "@kesko/css/dist/kesko.min.css";
@import "@kesko/css/dist/components.min.css";React consumers do not need this import. @kesko/components pulls in the matching CSS per component automatically.
Applying a brand theme #
To apply a brand theme on top, add a theme override from @kesko/themes:
@import "@kesko/css/dist/kesko.min.css";
@import "@kesko/themes/dist/k-rauta.css";Because all utility classes reference design token custom properties via var(), they automatically adapt when a theme overrides those properties. There is no need for dark mode utility prefixes; swapping a theme file handles it transparently.
Utility classes #
Utility class names follow Tailwind CSS conventions, prefixed with k-. All directional utilities use CSS logical properties for RTL support.
Text colors #
Set color from semantic text tokens.
<p class="k-text">Default text</p>
<p class="k-text-weak">Secondary text</p>
<p class="k-text-accent">Accent text</p>Background colors #
Set background-color from semantic background, status, fill, and surface tokens.
<div class="k-bg">Default background</div>
<div class="k-bg-muted">Muted surface</div>
<div class="k-bg-accent">Accent surface</div>Borders #
The base .k-border class applies a solid border using --k-size-border width and --k-color-border color. Directional variants use CSS logical properties. Color variants change only the border-color.
<div class="k-border">All sides</div>
<div class="k-border-t">Top only</div>
<div class="k-border k-border-active">Active border color</div>Font sizes #
Set font-size from font size tokens. Uses the text- prefix following Tailwind convention.
<p class="k-text-sm">Small text</p>
<p class="k-text-lg">Large text</p>
<h1 class="k-text-3xl">Heading</h1>Font weights #
<span class="k-font-normal">Normal</span>
<span class="k-font-bold">Bold</span>
<span class="k-font-black">Black</span>Font families #
<p class="k-font-sans">Sans-serif text</p>
<code class="k-font-code">Monospace text</code>Line heights #
<p class="k-leading-sm">Tight leading</p>
<p class="k-leading-md">Comfortable leading</p>Padding #
Set padding from space tokens. Directional variants use CSS logical properties.
<div class="k-p-md">16px padding on all sides</div>
<div class="k-px-lg k-py-sm">24px inline, 12px block</div>
<div class="k-pt-xl">32px padding at block-start</div>Available suffixes: k-p, k-px, k-py, k-ps, k-pe, k-pt, k-pb. Available sizes: 4xs, 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl.
Margin #
Same directional pattern as padding (k-m, k-mx, k-my, k-ms, k-me, k-mt, k-mb), plus auto helpers for centering.
<div class="k-m-md">16px margin on all sides</div>
<div class="k-mx-auto" style="width: 20rem">Centered block</div>Gap #
Set gap from space tokens, used with flexbox or grid layouts.
<div class="k-gap-md" style="display: flex">
<div>A</div>
<div>B</div>
<div>C</div>
</div>Border radius #
Set border-radius from radius scale tokens. k-rounded with no size suffix maps to md (the system default).
<div class="k-rounded">Default radius (md)</div>
<div class="k-rounded-lg">Large radius</div>
<div class="k-rounded-pill">Pill shape</div>Box shadows #
<div class="k-shadow">Subtle shadow</div>
<div class="k-shadow-float">Floating card</div>
<div class="k-shadow-popover">Popover shadow</div>Component classes #
For every component in @kesko/components, the framework also ships a matching set of CSS classes, so non-React consumers can apply the same look and feel with plain HTML. Use these for static markup or server-rendered views; for interactive behavior (loading states, keyboard handling, ARIA wiring), reach for @kesko/components instead.
Button #
Base class .k-button. Stack a variant and size modifier on top.
- Variants:
.k-button-primary,.k-button-secondary,.k-button-plain,.k-button-text,.k-button-inverted - Sizes:
.k-button-sm,.k-button-lg(default ismd) - Modifiers:
.k-button-expand,.k-button-transparent,.k-button-icon-only
<button class="k-button k-button-primary">Primary</button>
<button class="k-button k-button-secondary k-button-lg">Large secondary</button>
<button class="k-button k-button-text">Text</button>
<button class="k-button" disabled>Disabled</button>Each button exposes a public theming API via --k-button-* custom properties (-bg, -text, -border, -radius, and matching -hover / -active variants). Set them on :root or any scoped selector to override defaults for a single instance, a section, or the whole app.
Spinner #
.k-spinner wraps four <span> children that animate as bouncing dots.
Sizes: .k-spinner-sm, .k-spinner-lg, .k-spinner-xl, .k-spinner-2xl. The default size inherits from the current font size, which makes the spinner compose cleanly inside buttons and other text contexts.
<span class="k-spinner" role="status" aria-label="Loading">
<span></span>
<span></span>
<span></span>
<span></span>
</span>Theming: --k-spinner-color, --k-spinner-size.
Stack #
.k-stack is a flex layout primitive with a md gap by default.
- Direction:
.k-stack-row - Wrap:
.k-stack-wrap - Alignment:
.k-stack-align-center,.k-stack-align-end,.k-stack-align-stretch - Gap:
.k-stack-gap-3xsthrough.k-stack-gap-3xl(omit for the defaultmd)
<div class="k-stack k-stack-row k-stack-gap-sm k-stack-align-center">
<button class="k-button">A</button>
<button class="k-button">B</button>
</div>Visually hidden #
.k-visually-hidden removes an element visually while keeping it available to assistive technologies. Used for screen-reader-only labels.
<button class="k-button">
<svg aria-hidden="true">…</svg>
<span class="k-visually-hidden">Close dialog</span>
</button>Example #
Combining utilities and component classes to build a card:
Card title
Supporting text with muted color and compact size.
<div class="k-bg k-p-lg k-rounded-lg k-shadow">
<h2 class="k-text k-text-2xl k-font-bold k-mb-sm">Card title</h2>
<p class="k-text-weak k-text-sm k-leading-md k-mb-md">Supporting text with muted color and compact size.</p>
<button class="k-button k-button-primary">Action</button>
</div>