refract v0.1 · beta
Subsystems / Borders

Borders

One stroke vocabulary — width, style, offset and radius — plus edge recipes that compose them, per side.

raw slice the input
live render radius / border / outline
refracted: radius chips + the edge recipes are real emitted classes (dt-borders-edge-*); the components on the Components page compose borders: "edge.button" / "edge.card" for their corners.

Overview

The borders subsystem is the dedicated stroke subsystem. Border and outline share one geometry vocabulary (width / style / offset / radius); a recipe diverges only at the render target via the as verb. Colour is never a borders token — a borders recipe carries a value-level colors.* ref instead.

Properties

Four geometry token families — a base value plus named variants, emitted as :root variables. width / offset are numbers → px; radius is a number → px (or a string like "9999px"); style is a raw keyword.

PropertyValue typeEmitted variableDescription
widthnumber--dt-borders-width-<v>border / outline width (px).
stylestring--dt-borders-style-<v>solid / dashed / … (plus auto for outlines).
offsetnumber--dt-borders-offset-<v>outline-offset (px) — only meaningful under as: "outline".
radiusnumber | string--dt-borders-radius-<v>border-radius (px); "9999px"-style strings allowed.

Base at token path borders.<prop> / --dt-borders-<prop>; each variant at borders.<prop>.<variant> / …-<variant>.

borders.ts
borders: {
  width:  { base: 1, variants: { thick: 2, hair: 0.5 } },
  style:  { base: "solid", variants: { dashed: "dashed" } },
  offset: { base: 2, variants: { lg: 4 } },
  radius: { base: 8, variants: { none: 0, lg: 16, pill: "9999px" } },
}

Recipes — as / side + geometry aspects

A borders recipe composes the geometry into one class. The aspects (width / style / offset / radius) each name a variant of the matching property; as and side are modifiers that route each aspect to its longhand; color is a value-level colors.* token ref.

PropTypeDescription
as"border" | "outline"Render target (default "border"). Routes every aspect to its longhand.
side"top" | "right" | "bottom" | "left"Per-side modifier (border only) → border-<side>-{width,style,color}.
widthstringNames a width variant.
stylestringNames a style variant.
offsetstringNames an offset variant (outline-only).
radiusstringNames a radius variant (always border-radius).
colorstringA colors.* token path ("colors.primary") — never a borders token → border/outline-color.

The CSS longhand is computed from (as, side, aspect):

  • radius → always border-radius; offset → always outline-offset.
  • as: "outline"outline-<aspect> (width / style / color).
  • otherwise border-<aspect>, or border-<side>-<aspect> when a side is set.
borders.recipes.ts
borders.recipes: {
  edge: {
    card:    { width: "base", style: "base", radius: "lg", color: "colors.primary" },
    focus:   { as: "outline", width: "thick", style: "base", offset: "lg", color: "colors.primary" },
    divider: { side: "bottom", width: "hair", style: "base", color: "colors.primary" },
  },
}
dist/theme.css · emitted
/* as: "border" (default) — full border */
.dt-borders-edge-card {
  border-width: var(--dt-borders-width);
  border-style: var(--dt-borders-style);
  border-radius: var(--dt-borders-radius-lg);
  border-color: var(--dt-colors-primary);   /* a colors.* ref */
}
/* as: "outline" — offset only applies here */
.dt-borders-edge-focus {
  outline-width: var(--dt-borders-width-thick);
  outline-style: var(--dt-borders-style);
  outline-offset: var(--dt-borders-offset-lg);
  outline-color: var(--dt-colors-primary);
}
/* side: "bottom" — per-side longhands */
.dt-borders-edge-divider {
  border-bottom-width: var(--dt-borders-width-hair);
  border-bottom-style: var(--dt-borders-style);
  border-bottom-color: var(--dt-colors-primary);
}
The recipe class is dt-borders-<group>-<variant> (read from theme.classes.borders.<group>.<variant>); a component recipe composes it like any other subsystem — borders: "edge.card".
Technical documentation for @theme-registry/refract · all output is compiled client-side by the real library (CSS adapter). The chrome is theme-aware; the render panes carry each preset's own world. · MIT licensed.