Skip to content

Design Pattern

Status: Running today. The Nimi design pattern (P-DESIGN-*) is the shipped cross-app authority for shared visual + interaction contracts.

The Nimi design pattern is the platform-wide visual + interaction authority that sits inside @nimiplatform/nimi-kit/ui. It governs every Nimi-governed app — Desktop, Forge, Relay, Overtone, parentOS, and any future first-party app — under one design language with a small set of admitted theme expressions.

Foundation Authority

RuleValue
Authority spec.nimi/spec/platform/kernel/design-pattern-contract.md
Authority tables.nimi/spec/platform/kernel/tables/
Governed appsdesktop, forge, relay, overtone, parentos (and any later-admitted app)
App-local design prose mayDescribe art direction
App-local design prose may NOTRedefine shared primitive families, token taxonomies, or governance rules

Theme Pack Model (P-DESIGN-002)

The shared design foundation is constant across apps. App identity comes from accent packs that layer on top.

LayerWhat it provides
Foundation schemeShared light / dark scheme (nimi-light, nimi-dark)
Accent packExactly one per app (e.g., desktop-accent, forge-accent, relay-accent, overtone-accent)

Governed app entries import:

@nimiplatform/nimi-kit/ui/themes/light.css
@nimiplatform/nimi-kit/ui/themes/dark.css
@nimiplatform/nimi-kit/ui/themes/<app>-accent.css   (exactly one)

There is no "mix two accent packs" mode and no "skip the foundation scheme" mode.

Semantic Token Taxonomy (P-DESIGN-003)

Shared semantic tokens live in tables/nimi-ui-tokens.yaml. The admitted token categories include:

CategoryExamples
surfaceBackground tones
textText tones
actionAction / button tones
overlayOverlay surfaces
sidebarSidebar tones
fieldForm field tones
statusStatus tones
radiusCorner radii
spacingSpacing scale
typographyFont + size + weight
strokeStroke weights
elevationElevation tokens
motionMotion durations + easing
zZ-index scale
sizingComponent size tokens
borderBorder tones
opacityOpacity scale
focusFocus ring tones
scrollbarScrollbar tones
toggleToggle tones
materialMaterial tokens (see Nimi UI Material)
backdropBackdrop blur tokens
ambientAmbient effect tones

Each semantic token declares whether it is a foundation or accent layer token. Theme pack values live in tables/nimi-ui-themes.yaml.

App code must not invent parallel token registries for governed surfaces.

Theme Scheme Contract (P-DESIGN-004)

RuleValue
Resolved scheme stateslight or dark
Apps may NOT defineParallel app-local theme entrypoint or root token system
Accent packs mayExpress product identity
Accent packs may NOTRedefine primitive family structure

Primitive Visual Authority (P-DESIGN-005)

RuleValue
Variant taxonomy authoritytables/nimi-ui-primitives.yaml
Implementation patternCVA (class-variance-authority) + Tailwind utility classes inside kit/ui
Behavioral primitivesRadix UI headless primitives
Theme registrationSemantic tokens via Tailwind @theme in generated CSS
Primitive CSS class selectorsNOT generated separately; CVA composes
App / shared-lib code mayCompose shared primitives
App / shared-lib code may NOTDefine CVA variants for shared primitive families outside kit/ui

No App-Local Primitive Redefinition (P-DESIGN-006)

RuleValue
Governed app stylesheets may NOTDefine CVA variants or Tailwind utility overrides targeting shared primitive families
App-local wrappers mayAdd composition class names
App-local wrappers may NOTRedefine shared primitive visual contract
Controlled exceptions mayStyle app-owned selectors only

No App-Local Token Overrides (P-DESIGN-007)

RuleValue
Governed app stylesheets may NOTAssign values to --nimi-* CSS variables
Shared semantic token valuesOriginate only from generated theme CSS emitted from tables/nimi-ui-themes.yaml
Shared-lib handwritten CSS mayRead semantic tokens
Shared-lib handwritten CSS may NOTProvide fallback token authority

Accent Alias Phase-Out (P-DESIGN-008)

Generated accent packs emit shared --nimi-* semantic token values only. App-scoped alias namespaces (--ot-*, --color-ot-*, --color-brand-*, --color-accent-*) are not long-term authority. Legacy full-theme compatibility outputs (relay-dark.css, overtone-studio.css) cannot remain in the generated shared-lib theme surface once foundation-plus-accent is active.

Governed app chrome may layer app identity through shared semantic tokens and local color-mix(...) expressions, but not through app-scoped accent aliases for shared background / text / focus / surface meaning.

Shared Primitive Contract (P-DESIGN-010)

Shared primitives:

  • Delivered by @nimiplatform/nimi-kit/ui
  • Built on Radix UI headless primitives (Dialog, Tooltip, ScrollArea, Select, Switch, Avatar, Popover)
  • Styled with CVA + Tailwind referencing --nimi-* semantic tokens

Governed app modules must use shared primitives for shell-level families: surface, action, overlay, sidebar, field, status, scroll_area, toggle, avatar. Thin compatibility wrappers are permitted only if they delegate directly to @nimiplatform/nimi-kit/ui and do not redefine the visual contract.

Reader Scenario: Adding An Accent Pack For A New App

A new admitted Nimi app needs its own accent identity.

  1. Add accent pack. A new <app>-accent.css lands under @nimiplatform/nimi-kit/ui/themes/.
  2. Tokens overridden. The accent pack assigns values to admitted accent-layer semantic tokens; foundation tokens stay untouched.
  3. App imports. App entry imports the foundation light + dark CSS plus exactly its own -accent.css.
  4. Visual identity emerges. The app feels distinct while sharing the foundation scheme.

The accent pack did not invent new token namespaces. It values admitted tokens.

Reader Scenario: A Mod Wants A New Visual Variant

A mod author wants a button variant that doesn't match any admitted shared primitive variant.

  1. Check the variant table first. tables/nimi-ui-primitives.yaml declares admitted variants.
  2. If the variant isn't there: the mod cannot define a new CVA variant for the shared primitive family in app-local code.
  3. Options: propose a new admitted variant for the shared primitive (governance flow), or use a custom app-local component that does not hold the same primitive name.

The boundary keeps the shared primitive contract honest.

What The Design Pattern Does Not Do

  • It does not allow per-app shared primitive redefinition.
  • It does not allow per-app --nimi-* token overrides.
  • It does not let accent packs change foundation tokens.
  • It does not allow free-form CSS to claim authority over shared primitive families.

Boundary Summary

ConcernAuthority
Foundation authorityP-DESIGN-001
Theme pack modelP-DESIGN-002
Semantic token taxonomyP-DESIGN-003 + tables/nimi-ui-tokens.yaml
Theme scheme contractP-DESIGN-004
Primitive visual authorityP-DESIGN-005 + tables/nimi-ui-primitives.yaml
App-local redefinition rulesP-DESIGN-006, P-DESIGN-007, P-DESIGN-008
Shared primitive contractP-DESIGN-010

Source Basis

Nimi AI open world platform documentation.