Introducing a new way to review your PRs.

Read the announcement

spartan-ng / spartan

Cutting-edge tools powering Angular full-stack development.

View on GitHub

18 documents · Updated Nov 23, 2026

docs / registry-and-theming

Component registry and theming

The registry package is the shared source for distributable component metadata, style choices, and theme data. It gives the CLI, documentation tools, and integrations common names and data shapes so they can select components and visual presets without inventing separate contracts.

Registry package

The registry package sits between component content and the tools that deliver or display it. It describes what a distributable item is, how a registry can be addressed, and which visual choices are available.

Distribution metadata

Distribution metadata describes a component or other deliverable as a named registry item. An item can point to files, dependencies, CSS variables, or special data such as a base configuration or font record. A registry groups these items under a name and home page, while an index can expose a list of items without the full registry wrapper.

The package also describes workspace configuration and search results. This lets tooling carry project paths, aliases, registry sources, and add-command information through a shared shape. Registry URLs use a {name} placeholder so a tool can resolve a requested item from a registry family.

See registry schemas and style assets for the field-level contract and the asset relationship.

References: libs/…/schema.ts• L6-59 libs/…/schema.ts• L61-167 libs/…/schema.ts• L178-194

Theme choices

Themes provide color-token choices for an application. Each theme is a registry theme item with a stable name, a display title, and light and dark token values. Components consume the token names rather than a theme-specific color, which lets the same component set work across the available themes.

The current registry themes include neutral base values and named color variants such as amber, blue, cyan, emerald, fuchsia, green, indigo, lime, orange, pink, purple, red, rose, sky, teal, violet, and yellow. The theme data covers shared surfaces and text as well as primary and sidebar roles. The CLI theme flow has its own supported color set for application setup, so changes to the registry theme data must be considered with that tooling contract.

References: libs/…/themes.ts• L1-3 libs/…/themes.ts• L5-68 libs/…/themes.ts• L269-292 libs/…/themes.ts• L694-696 libs/…/colors.ts• L1-3 libs/…/colors.ts• L299-306

Style choices

Styles are component-level visual systems. Unlike a theme, which mainly changes token values, a style changes the presentation rules that components use for size, spacing, shape, density, and interaction states. The supported style set is ordered with nova first as the default, followed by vega, lyra, maia, mira, and luma.

Each style has a CSS asset with rules for the shared spartan-* component classes. The assets cover the common component surface used by generated applications and previews, while each style gives that surface a different visual density and shape. The assets also define a common chart surface and tooltip contract. Lyra keeps the tooltip sharp, while Luma uses a softer treatment. Nova additionally provides the page-wide documentation baseline and keeps nested style previews isolated from it. The style list, asset names, and preview containment set must remain complete.

Chart styling uses the same semantic color tokens as the rest of the component system. The style assets keep chart layout consistent across choices while allowing presentation details to differ. The registry test checks the shared chart contract across every style and preserves these intentional differences.

See registry schemas and style assets for the relationship between style names and CSS files.

References: libs/…/style.ts• L1-3 libs/…/style-nova.css• L1-31 libs/…/style-nova.css• L341-347 libs/…/style-vega.css• L311-316 libs/…/style-lyra.css• L293-298 libs/…/style-maia.css• L311-316 libs/…/style-mira.css• L311-316 libs/…/style-luma.css• L1463-1468 libs/…/chart-styles.spec.ts• L15-48

Tooling flow

Tooling turns the registry choices into either project output or a visual preview. The CLI uses a selected style when it creates or updates project configuration and generated component output. Documentation tooling reads the same registry CSS assets to produce previews for every supported style. The documentation baseline is kept separate from nested style previews so the preview shows the selected style rather than inherited default rules.

The theme generator applies a selected light and dark color scheme to an application stylesheet. It can make that scheme global or place it behind a prefix so one application can host more than one theme. The flow below shows how the shared choices reach those consumers.

This diagram shows how registry data moves from shared names and assets to generated applications and previews.

flowchart LR
    R[Registry package] --> M[Shared metadata and schemas]
    R --> T[Theme token choices]
    R --> S[Style names and CSS assets]
    M --> I[CLI and integrations]
    T --> G[Theme generator]
    S --> C[CLI build and component generation]
    S --> P[Documentation previews]
    G --> A[Application stylesheet]
    C --> A
    C --> U[Consumer component output]
    P --> D[Style comparison views]

For the CLI workflow, see CLI and generators and CLI UI library generation.

References: libs/…/index.ts• L1-2 libs/…/project.json• L8-26 libs/…/config.ts• L8-32 libs/…/generator.ts• L8-16 libs/…/add-theme-to-application-styles.ts• L15-24 libs/…/generator.ts• L132-147

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the registry item schema and the published JSON schema aligned when the item contract changes.
  • Keep the style name list, every style-<name>.css asset, the CLI's mirrored style list, and preview generation in sync.
  • Keep Nova's documentation preview containment list synchronized with the supported style names when a style is added or renamed.
  • Keep the shared chart selectors and tooltip variables aligned across every style asset when chart support changes.
  • Keep theme names and token roles aligned between registry theme data and the CLI's application theme choices.
  • Preserve the {name} registry URL contract when changing registry source support.
  • Check both light and dark token output when adding or changing a theme.

Important failure modes

TriggerConsequenceGuard
A style name has no matching CSS assetA CLI build or preview cannot produce the selected styleKeep STYLES and the style-<name>.css set together; the registry style tests read one asset for each style
A new style is missing from Nova's preview containment listThe page-wide Nova rules can leak into that style's documentation previewUpdate the Nova containment set with every non-Nova style
A style asset omits the shared chart layout or tooltip variablesCharts can render with a missing layout or an inconsistent tooltipKeep the chart contract in every style asset; chart-styles.spec.ts checks all registry styles
A CSS asset omits reduced-motion guards for dropdown animationUsers who request reduced motion can still receive unguarded menu animationThe registry style test checks both dropdown content selectors across all styles
Registry and published JSON schemas divergeA valid source item can fail validation in an external consumerUpdate both schema definitions in the same change
A theme is accepted by one tool but absent from the other theme setAn application setup or integration can reject a choice that another surface presentsTreat registry theme data and CLI theme choices as one compatibility contract

Key files

FileWhy to read it
libs/…/index.tsShows the public registry package exports.
libs/…/schema.tsDefines the shared registry, item, configuration, search, and preset contracts.
libs/…/themes.tsDefines the available registry theme items and their light and dark token values.
libs/…/style.tsDefines the supported style names and their default order.
libs/…/style-nova.cssShows the default style asset, shared component styling surface, and documentation preview containment.
libs/…/style-vega.cssShows how a style asset applies the shared component and chart styling contract.
libs/…/style-lyra.cssShows the sharp style variant and its distinct tooltip treatment.
libs/…/style-maia.cssShows a rounded, spacious style variant across the shared component surface.
libs/…/style-mira.cssShows a compact style variant across the shared component surface.
libs/…/style-luma.cssShows the soft style variant and its chart tooltip treatment.
libs/…/chart-styles.spec.tsStates the shared chart styling contract and the intentional tooltip differences between styles.
libs/…/dropdown-menu-reduced-motion.spec.tsExpresses the cross-style reduced-motion guarantee for menu animation.
libs/…/supported-styles.tsShows the CLI copy of the style choice contract.
libs/…/colors.tsShows the theme choices used when the CLI writes application color tokens.
libs/…/add-theme-to-application-styles.tsShows the application-level effect of selecting a theme.
libs/…/generator.tsShows how the documentation preview flow consumes every registry style asset.