Utilities
Global layout and text helper classes that ship with the component stylesheet.
@surface-one/angular/styles.css (and @surface-one/vue/styles.css, @surface-one/react/styles.css) include a few global helper classes, so an app does not rewrite the same flex boxes and text styles in every component. Every value is a token.
Layout
.stack— a flex column; gap--space-3..cluster— a wrapping, vertically centred row of chips or buttons; gap--space-2..row— a centred row that does not wrap;.row-betweenpushes its ends apart. Gap--space-2.data-gap="1"…"8"on any of them picks the--space-1…--space-8step.
<section class="stack" data-gap="4">
<header class="row-between">
<h2 class="truncate">Quarterly planning</h2>
<button soneBtn variant="outline" size="sm" type="button">Share</button>
</header>
<div class="cluster">
<span soneBadge>Product</span>
<span soneBadge variant="secondary">Design</span>
</div>
</section>Text
.text-hint— a secondary line under a control or an empty state: secondary ink,sm, normal leading, no margin..text-caption— small print: muted ink,xs..truncate— one line cut with an ellipsis;min-width: 0lets it shrink inside a flex or grid track..list-reset— a<ul>/<ol>without bullets, margin or padding..text-secondary,.text-muted,.text-success,.text-danger,.section-labeland.sr-onlyare there as well.
<p class="text-hint">Touch ID unlocks it for this session.</p>
<span class="text-caption">Edited 2 min ago</span>
<ul class="list-reset stack" data-gap="1">
<li class="truncate">A long title that ends in an ellipsis…</li>
</ul>These are plain class names. If your app already uses .row or .stack for something else, the global rule applies there too — rename your own class or keep the properties it sets.
Style rules
@surface-one/stylelint-config turns the tokens-only rule into a lint. It uses stylelint's core rules only, reads .css, .scss and the <style> blocks of .vue files, and every message names the token to use instead:
- No raw colours — no hex, no named colours, no
rgb()/hsl()/oklch(). Use a theme token such asvar(--text-primary), orcolor-mix()over tokens for a tint;transparentandcurrentColorstay allowed. - No raw
pxingap,padding,margin,border-radius,box-shadow,font-sizeorletter-spacing: use--space-*,--radius-*,--shadow-*,--font-size-*and--tracking-*.0is fine, and structural sizes (width,height,min-*,max-*,inset) keep their pixels. z-indextakes the--z-*ladder —var(--z-raised),var(--z-dropdown),var(--z-modal)… — or one step off a rung,calc(var(--z-raised) + 1).- The hairline is
var(--border-width-thin) solid, never1px solid. backdrop-filteris only the skin's scrim:blur(var(--scrim-blur)).- Durations come from
--transition,--transition-fastand the--duration-*steps, never rawmsors.
npm install -D stylelint @surface-one/stylelint-config
# or from GitHub Packages, under the same alias as the other packages:
npm install -D stylelint @surface-one/stylelint-config@npm:@monoone-dev/surface-one-stylelint-config// stylelint.config.mjs
export default {
extends: ["@surface-one/stylelint-config"],
// Your own token definitions are the one place raw values belong.
ignoreFiles: ["src/styles/tokens/**"],
};Exempt only the files that define your own tokens. When a raw value is truly structural, silence that one line and say why — a disable without a reason, or one that silences nothing, is an error too:
.knob {
/* stylelint-disable-next-line declaration-property-unit-disallowed-list -- the 3px halo is part of the glyph */
box-shadow: 0 0 0 3px var(--surface-base);
}