Introduction
Netzi's component kit on top of @netzi/tokens. Browse the menu to see every component.
Netzi UI is Netzi's component kit for Angular, built on the tokens of @netzi/tokens. It is batteries-included: every component arrives styled, accessible and ready — everything is enabled by parameters, without assembling the UI by hand each time.
What is in the kit
Forms: text, number, currency, select, autocomplete, checkbox/toggle, radio, segmented, search, phone, OTP, tags, slider, rating, color, file, date, time.
Actions: buttons, tabs, pagination.
Data: data table (advanced), simple table, badges, avatars.
Overlays: modal, drawer, menu, tooltip, popover.
Feedback: alerts, toasts, spinner, progress, skeleton.
Structure: layout (admin shell) + topbar widgets (⌘K, language, notifications, contacts, settings, account), divider.
Browse the menu on the left to see each one with its example, code and props.
Pillars
Themes
Light and dark (plus high contrast) with the data-theme attribute and the theme engine, which follows the system by default. Everything comes from --netzi-* tokens.
Real RTL
Logical properties across the kit: with dir="rtl" it flips on its own.
i18n
Visible texts configurable by input (with Spanish by default).
By parameters
One component encapsulates everything; you enable what you need with props ([exportable], [filterable]…).
Installation
The packages live on the public npm under the @netzi scope: no special registry or token needed. They are free to use in any application and the code stays private (they ship compiled, with their LICENSE.md). While the kit is in beta, every new version is a beta and it is the one installed by default.
This documentation covers these versions, each with its page on npm:
# public npm, @netzi scope owned by Netzi Tech: no special registry or token
pnpm add @netzi/ui @netzi/tokens
# or: npm install @netzi/ui @netzi/tokens
# import the base styles + tokens once (e.g. in styles.css)
@import '@netzi/tokens/styles/index.css';Usage
Every component is standalone: import it and use it. Configuration goes through inputs.
import { NetziButton, NetziDataTable } from '@netzi/ui';
@Component({
selector: 'mi-pagina',
imports: [NetziButton, NetziDataTable], // standalone
template: `
<button netzi-button variant="primary">Guardar</button>
<netzi-data-table [data]="filas" [columns]="cols" [filterable]="true" />
`,
})
export class MiPagina {}Text tokens
Three levels with different roles, not three interchangeable shades of gray. The ratios are the worst of the theme's four surfaces (bg, surface, surface-2 and surface-3) and are measured, not estimated: each token declares its contrast contract and the @netzi/tokens build checks it in every theme, so if a value stops complying the package does not build. WCAG 2.1 asks for 4.5:1 for normal text (SC 1.4.3) and 3:1 for meaningful non-text (SC 1.4.11). With high contrast, primary and secondary text reach 7:1 (SC 1.4.6), and the contract requires that too. The ambient background does not change them: it only goes under the top bar and the sidebar, and text reads it through the glass, where the build checks it too.
| Sample | Token | What for | Light | Dark |
|---|---|---|---|---|
| Main text | --netzi-text | Headings, values and body. | 13.7:1 | 15.2:1 |
| Secondary text | --netzi-text-2 | Any readable secondary text: labels, hints, footers, metadata and placeholders. | 7.0:1 | 9.1:1 |
| Non-text | --netzi-text-3 | Decorative icons, chevrons, separators, lines and disabled states. Not for text: it meets 3:1, not 4.5:1. | 3.2:1 | 3.3:1 |
With data-contrast="high" each level takes the value of the one above: text-2 rises to 11.3:1 (14.0:1 in dark) and text-3 to 7.0:1 (9.1:1 in dark), so the mode complies even where someone used text-3 for text. text-2 and the -text of the four states are also read on the selected tint, with the hover, focus or pressed state on top, and under the state layers: the build measures it with every preset (#308).
State tokens and tints
The four states have aliases by what they mean, besides the raw color. They exist because a token that does not exist does not fail: the whole declaration is dropped and the element is left without background, color or radius, with no warning at build time or in the console. For the same reason each role has a single name: the synonyms --netzi-surface-1, --netzi-text-1 and --netzi-radius-md are deprecated and go away at the earliest in @netzi/tokens 0.1.0-beta.11; use --netzi-surface, --netzi-text and --netzi-radius-surface-sm. The split is the usual one: the raw color is fill and the -text is what is read.
| Sample | Alias | Color | Background | What for |
|---|---|---|---|---|
| Information | --netzi-info | --netzi-blue | --netzi-info-bg | Neutral notices, hints and in-progress states. |
| Success | --netzi-success | --netzi-green | --netzi-success-bg | Confirmations and healthy states. |
| Warning | --netzi-warning | --netzi-yellow | --netzi-warning-bg | Something needs review, but nothing is broken. |
| Error | --netzi-danger | --netzi-red | --netzi-danger-bg | Errors, validations and destructive actions. |
A piece of a state with text on top —a badge, a chip, a banner, the danger action under the pointer— sits on --netzi-*-bg: the state color mixed with --netzi-bg, opaque, with its -text on top. Opaque because its text cannot depend on what is underneath (a selected row, a row under the pointer, the glass), and with bg because no layer redefines it. The build contract measures the text on it in every theme, and in dark each background sits at the level of the neutral chip, above the card. What already carries its background at rest, like sign-out, moves to --netzi-danger-bg-hover under the pointer.
What signals a state without being text —the presence dot, the marked star, the border of an invalid field, the icon of a result— uses --netzi-*-graphic (info, success, warning, danger): the shade closest to the raw color that reaches 3:1 on every surface, in light and dark and with every preset. In light the raw color stays between 1.33 and 2.15:1. If the icon sits on a round background of its own color, that background is --netzi-*-veil (the graphic at 14%), and the graphic also reaches 3:1 on it.
And two tints of the primary, which differ not by taste but by how much text they can hold on top. The soft one is calibrated for large surfaces and is the ceiling of --netzi-primary-text (4.53:1, just); the strong one is for small pieces, where the soft one gets lost against the background, and its ink is --netzi-text.
What is not text but conveys something —the fill of a progress bar or a slider, the underline of the active tab, the ring around what is selected, a loading ring— has to reach 3:1 against what sits next to it (WCAG 1.4.11), and the raw primary does not get there in light with blue, green, orange, red or cyan. That is what --netzi-primary-graphic is for: the shade closest to the primary that meets it on every surface and on the tint, calibrated per preset and per theme. If it also pulses in opacity, use --netzi-primary-text, which leaves room for the low point of the pulse.
/* States: the raw one FILLS, -text is READ and -graphic SIGNALS. */
.mi-fondo { background: var(--netzi-success); }
.mi-mensaje { color: var(--netzi-danger-text); }
.mi-etiqueta { background: var(--netzi-success-bg); /* its background, opaque */
color: var(--netzi-success-text); }
.mi-borrar:hover { background: var(--netzi-danger-bg); } /* danger action */
.mi-punto { background: var(--netzi-success-graphic); } /* 3:1 */
.mi-invalido { border-color: var(--netzi-danger-graphic); }
.mi-icono { color: var(--netzi-warning-graphic);
background: var(--netzi-warning-veil); } /* its veil */
/* Primary tints: they follow the theme preset. */
.mi-fila-activa { background: var(--netzi-primary-tint); } /* large surface */
.mi-chip { background: var(--netzi-primary-tint-strong); /* small piece */
color: var(--netzi-text); }
/* Non-text elements that convey meaning (a bar, a ring): 3:1 in every preset. */
.mi-barra { background: var(--netzi-primary-graphic); }Public and internal tokens
Not everything tokens.css declares is meant for your app. Each token says whether it is public —the contract: you can use and override it, and it does not change without a deprecation— or internal, which may change in any version. The whole semantic layer is public, and an app uses roles: group spacing (--netzi-space-group), the control radius (--netzi-radius-control), the style of a title (--netzi-typography-title). Primitives are internal: raw brand colors such as --netzi-blue go through the primary and the states, and the step-named scales (--netzi-space-4, --netzi-radius-sm, --netzi-font-size-md…) stay public but deprecated, and become internal at the earliest in @netzi/tokens 0.1.0-beta.11. The package ships the list in public-tokens.json, and no demo in this playground uses an internal token.
// The list of public tokens ships in the package, generated by its build.
import publicos from '@netzi/tokens/public-tokens.json' with { type: 'json' };
// [{ name: '--netzi-primary-text', path: 'primary.text', layer: 'semantic' }, …]
const nombres = new Set(publicos.tokens.map((t) => t.name));
nombres.has('--netzi-primary'); // true: use it
nombres.has('--netzi-blue'); // false: internal, use --netzi-primary or --netzi-infoSpacing
Spacing goes by role, from nearest to farthest: the more related two things are, the less air between them. Compact density shrinks it from inset-sm upwards without leaving the scale: each one drops to the step below (12 → 8, 16 → 12, 24 → 16, 32 → 24 and 48 → 32 px), except stack, which stays at 12 px to keep a step above group (8 px). The scale steps (--netzi-space-0 … -8) are deprecated for apps and become internal at the earliest in @netzi/tokens 0.1.0-beta.11.
.tarjeta {
display: flex;
flex-direction: column;
gap: var(--netzi-space-group); /* between siblings */
padding: var(--netzi-space-inset); /* card padding */
}
.formulario > * + * {
margin-top: var(--netzi-space-stack); /* between stacked groups */
}--netzi-space-related · 4px Pieces of the same element: icon and text, the chips of a list, a field and its hint.
--netzi-space-group · 8px Sibling elements of a group: the buttons of a bar, a header and its content.
--netzi-space-stack · 12px Groups stacked in a panel or a form: fields, rows, columns.
--netzi-space-inset-sm · 12px Padding of a compact container: a floating panel, a notice.
--netzi-space-inset · 16px Padding of a card or a panel.
--netzi-space-inset-lg · 24px Padding of a dialog, a side panel or a large card.
--netzi-space-section · 32px Between the sections of a page.
--netzi-space-page · 48px Between the large regions of a page and as its margin on wide screens.
Layout grid
Each window size has its layout grid: how many columns, the side margin of the view, the same at the start and at the end, and the gutter, which separates two columns and two panes. Margin and gutter are a step of the spacing scale, not a number of their own, so they drop to the step below with compact density (a 24 px margin becomes 16) and stay a step. A view sits on it with display: grid, a repeat() of the columns, a column-gap of the gutter and a padding-inline of the margin, switched at each window breakpoint, and each block spans a whole number of columns. The kit pieces follow it: netzi-layout gives its content and bars the class margin, measured from the safe area of a phone with a notch, and the window width sets it, not the menu mode (with the menu in a drawer between 600 and 1023 px it is still 24 px); and netzi-pane-layout separates its panes by the gutter and gives them whole columns: 4 + 4 in medium, 4 + 8 in expanded and large, and 4 + 5 + 3 in extra-large.
/* The view on the grid of its class: columns, gutter and margin. */
.mi-vista {
display: grid;
grid-template-columns: repeat(var(--netzi-grid-columns-compact), minmax(0, 1fr));
column-gap: var(--netzi-grid-gutter-compact);
padding-inline: var(--netzi-grid-margin-compact);
}
/* At each window breakpoint, the one for its class (a var() does not work inside
@media). */
@media (width >= 600px) {
.mi-vista {
grid-template-columns: repeat(var(--netzi-grid-columns-medium), minmax(0, 1fr));
column-gap: var(--netzi-grid-gutter-medium);
padding-inline: var(--netzi-grid-margin-medium);
}
}
/* A block spans a whole number of columns. */
.mi-vista__lista {
grid-column: span 4;
}| Width class | Columns | Margin | Gutter |
|---|---|---|---|
| Compact, below 600 px | --netzi-grid-columns-compact · 4 | --netzi-grid-margin-compact · 16px | --netzi-grid-gutter-compact · 16px |
| Medium, 600 to 839 px | --netzi-grid-columns-medium · 8 | --netzi-grid-margin-medium · 24px | --netzi-grid-gutter-medium · 24px |
| Expanded, 840 to 1199 px | --netzi-grid-columns-expanded · 12 | --netzi-grid-margin-expanded · 24px | --netzi-grid-gutter-expanded · 24px |
| Large, 1200 to 1599 px | --netzi-grid-columns-large · 12 | --netzi-grid-margin-large · 32px | --netzi-grid-gutter-large · 24px |
| Extra large, from 1600 px | --netzi-grid-columns-extra-large · 12 | --netzi-grid-margin-extra-large · 48px | --netzi-grid-gutter-extra-large · 24px |
Shape and elevation
Radii go by role: --netzi-radius-control for what you press, --netzi-radius-surface (and -sm) for cards and panels, and fully rounded things —pills, dots, avatars, switches— with --netzi-radius-pill, not 999px or 50%. Elevation says how far a piece lifts off what is under it, with an intent name: each theme paints it its own way (denser in dark, none on paper). A shadow is never the only thing that separates a layer: it has its border. The old shadows (--netzi-shadow-sm, --netzi-shadow and --netzi-shadow-lg) are deprecated and point to raised, floating and modal.
.mi-tarjeta-flotante {
border: var(--netzi-stroke-hairline) solid var(--netzi-border);
border-radius: var(--netzi-radius-surface);
box-shadow: var(--netzi-elevation-floating);
}
.mi-chip {
border-radius: var(--netzi-radius-pill); /* pill; on a square, a circle */
}--netzi-elevation-baseFlat on its surface, no shadow.
--netzi-elevation-raisedLifted over its surface: a thumb, a key.
--netzi-elevation-floatingSmall and loose over the content: a tooltip.
--netzi-elevation-modalWhat opens on top: dropdowns, dialogs, panels.
Layers
The z-index comes from a scale with intent names, bottom to top: whoever paints something on top says what it is, and the scale decides what covers what. Inside a piece, the order between siblings has a name too: below for what goes behind its own content and above for what goes over its siblings, and whatever sits right above another piece of its layer goes one step up with calc(). A guard fails on any bare number in the kit stylesheets, -1, 0 and 1 included.
/* A sticky app bar, above the table's sticky headers. */
.mi-barra {
position: sticky;
top: 0;
z-index: var(--netzi-layer-bar);
}
/* Inside your piece, the order between siblings has a name too. */
.mi-tarjeta__insignia {
position: absolute;
z-index: var(--netzi-layer-above);
}
/* Something right above another piece of its layer: one step, never more. */
.mi-panel-encima {
z-index: calc(var(--netzi-layer-dropdown) + 1);
}| Token | Value | What for |
|---|---|---|
--netzi-layer-below | -1 | Behind, inside the piece: the glass layer or the edge behind its panel. |
--netzi-layer-content | 0 | Page content: the starting point. |
--netzi-layer-above | 1 | Over its siblings, inside the piece: the pinned cell, the resize handle. |
--netzi-layer-sticky | 2 | Sticky headers and pinned columns of the data table. |
--netzi-layer-bar | 20 | Shell pieces that pass over the content: the menu collapse button, the loading bar. |
--netzi-layer-flyout | 50 | Submenus of the collapsed menu and context menus anchored to the content. |
--netzi-layer-scrim | 80 | The scrim of the side menu on mobile, which opens one step above it. |
--netzi-layer-modal | 100 | Dialogs and side panels, with their scrim inside. |
--netzi-layer-dropdown | 120 | Panels anchored to a control (select, date, popover…) and the ⌘K palette. |
--netzi-layer-toast | 200 | The toast: visible even with a modal or a dropdown open. |
--netzi-layer-tooltip | 300 | The label of whatever has the pointer or the focus. |
--netzi-layer-blocking | 1000 | The screen that blocks the app until something is solved (offline). |
--netzi-layer-top | 10000 | What can never be covered: “Skip to content” when focused. |
Strokes and icons
The width of what gets drawn —borders, outlines, rings and lines— comes from a scale with intent names: whoever draws says what the stroke is for, and the scale gives the width. Icons have three box sizes and one drawing width, in units of their 24 viewBox, which grows with the box. Neither changes with compact density or with text size. Color is separate: focus is var(--netzi-stroke-focus) solid var(--netzi-focus-ring). A guard fails on any bare width or icon size in the kit stylesheets; border: 0 and none need none, and the drawing of a chart or of the clock face, measured in its viewBox, is left out.
/* Your own card's border: the kit's hairline stroke. */
.mi-tarjeta {
border: var(--netzi-stroke-hairline) solid var(--netzi-border);
}
/* Focus: the ring width and its color, each from its own token. */
.mi-control:focus-visible {
outline: var(--netzi-stroke-focus) solid var(--netzi-focus-ring);
outline-offset: calc(var(--netzi-space-related) / 2);
}
/* Your own icon that looks like the kit's. */
.mi-icono {
inline-size: var(--netzi-icon-size-md);
block-size: var(--netzi-icon-size-md);
stroke-width: var(--netzi-icon-stroke);
}| Token | Value | What for |
|---|---|---|
--netzi-stroke-hairline | 1px | The thin stroke: the border of a control and of a surface, separators and dividers. |
--netzi-stroke-emphasis | 1.5px | What is checked, active or in error; the loading arc, an option checkbox, the drop zone. |
--netzi-stroke-focus | 2px | The focus ring, in forced colors too, and the ring of the active option in a list. |
--netzi-stroke-indicator | 2px | The active tab, a stepper line, the ring of what is chosen, the loading bar. |
--netzi-stroke-accent | 3px | The side band that marks the tone of an alert or a quote. |
--netzi-stroke-halo | 3px | The tint around a focused field: decoration, the indicator is the border. |
--netzi-icon-size-sm | 16px | Small icon: in a small control, a chip or a secondary line. |
--netzi-icon-size-md | 20px | The default: next to the text of a control, a menu item or an alert. |
--netzi-icon-size-lg | 24px | The one that stands alone in an icon button or a header. |
--netzi-icon-stroke | 1.75px | The drawing stroke of an icon. The value is not screen px but units of its 24 viewBox: it grows with the box (1.17px at sm, 1.46px at md, 1.75px at lg). |
Glass surfaces
With data-glass="on" the layers that float over the content —topbar, sidebar, anchored panels, modal, drawer, menus and toasts— become translucent with a blurred background. Content surfaces (cards, sections, tables) stay opaque: there the glass only takes legibility away. The two cards below are identical except for that attribute; you can turn it on for the whole showcase from the See-through panels switch in the settings panel. With the ambient background (data-ambient="on", the Tinted background switch), the top bar and the sidebar carry soft color stains underneath that their glass blurs, in light and in dark; they are not painted under the content, and without glass they do not show.
Opaque surface
The background is not visible. It is what the kit does by default.
Glass surface
The background shows blurred and saturated, and the text still meets the minimum.
The edge is what separates glass from a lit veil: there is light on the top edge and shadow inside the bottom one, so the layer has thickness. And the veil that dims the content behind a modal, a drawer, the ⌘K palette or the side menu on mobile comes from --netzi-scrim: it is the same for all, so the app does not darken differently depending on which layer covers it.
The contrast floor is not set by alpha alone. On glass, text is read against whatever is underneath, which changes when scrolling, so the case to meet is the most adverse background possible. Covering it with opacity alone requires an alpha so high that it no longer looks like glass; instead, the filter itself bounds the background before compositing it (contrast() compresses its range and brightness() pushes it toward the layer's tone), and with that an alpha of 0.51 in light and 0.12 in dark is enough: what is behind shows and the worst case still passes, with the layer's secondary text raised one level. In light it measures 4.73:1 on the strongest nested surface with pure black underneath; in dark, with pure white underneath, primary text measures 6.6:1 and secondary 5.35:1. With prefers-reduced-transparency: reduce or without backdrop-filter support, the usual opaque surface, and the layer's text goes back to the page's (except with high contrast, which keeps its own).
// From the theme engine (it persists it like the other axes).
private readonly theme = inject(NetziThemeService);
this.theme.setGlass(true);
// The axes are attributes, so they also work in a narrower scope, and they combine with
// the page ones as if they were on the same element: inside <html data-theme="dark">,
// this card gets the dark glass.
// <div data-glass="on"> … </div>
// Your own layer: netzi-float-scope (from base.css) re-scopes what its content inherits,
// like every kit layer: surfaces, secondary text and scrollbar thumb.
// <div class="mi-panel netzi-float-scope"> … </div>Changing the theme
Just set data-theme on a root (or use the theme engine). The settings button in this playground's topbar does it live.
<!-- dark theme: set data-theme on a root -->
<html data-theme="dark"> … </html>
<!-- high contrast -->
<html data-theme="dark" data-contrast="high"> … </html>
<!-- glass surfaces on the floating layers -->
<html data-theme="dark" data-glass="on"> … </html>By default the theme engine follows the system appearance: with mode: 'system' it listens to prefers-color-scheme and changes live if the person changes it; 'light' and 'dark' pin it. config().mode tells what was chosen and resolvedMode() what shows now: read the latter to know whether the interface is dark.
Showing now: Light
NetziThemeService
| Member | Type / values | Default | Description and effect |
|---|---|---|---|
config().mode | NetziThemeMode | 'system' | What was chosen. With 'system' it follows the system appearance (prefers-color-scheme) and changes live if the person changes it; 'light' and 'dark' fix it. It is persisted: whoever already chose light or dark keeps it. |
resolvedMode() | NetziResolvedThemeMode | — | What is painted now (read-only signal): the fixed mode or, with 'system', the system one. Read it to know whether the interface is dark; config().mode does not say it with 'system'. |
setMode(mode) | NetziThemeMode | — | Chooses the mode. setMode('system') goes back to following the system. |
toggleMode() | () => void | — | Switches to the opposite of what is shown now and leaves it fixed (it leaves system): meant for a sun and moon button. |
reset() | () => void | — | Goes back to the defaults, with the mode on 'system'. |
System contrast and forced colors
If the person asks for more contrast in their system (prefers-contrast: more), the tokens switch to high contrast on their own: the app does not have to do anything. Just leave data-contrast out; with the attribute the manual choice wins, normal too even if the system asks for more. The contrast switch in the settings panel shows on when the system asks for it, and turning it off fixes it at normal.
Contrast painted now: normal
With forced colors (forced-colors: active, the Windows contrast theme) the browser swaps backgrounds, text and borders for the colors the person chose and removes shadows. Every kit control keeps its border, its focus, what is selected and what is disabled with the system colors: selected with Highlight, disabled with GrayText and focus with an outline. A stylesheet guard and the playground audit with the Playwright emulation watch over it. If your app paints a state of its own only with color or a shadow, give it the same answer:
/* Your own state, with the colors the person chose */
.mi-opcion--elegida {
background: var(--netzi-primary-tint);
}
@media (forced-colors: active) {
.mi-opcion--elegida {
background: Highlight;
color: HighlightText;
}
.mi-campo:focus-visible {
outline: 2px solid Highlight; /* the shadow halo is not visible */
}
.mi-opcion:disabled {
color: GrayText;
}
}NetziThemeService
| Member | Type / values | Default | Description and effect |
|---|---|---|---|
resolvedContrast() | Signal<NetziResolvedThemeContrast> | — | The contrast painted now (read-only signal): 'high' if it was chosen by hand or if, without a manual choice, the system asks for it; otherwise 'normal'. config().contrast only tells the manual choice. |
config().systemContrast | boolean | true | While the contrast is not chosen by hand, it follows the system one (prefers-contrast: more) without writing data-contrast. setContrast() sets it to false and reset() brings it back to true. A configuration saved before this version follows the system, unless it chose high. |
config().contrast | boolean | false | The high contrast chosen by hand: with true the high one is painted whatever the system says. |
setContrast(high) | boolean | — | Fixes the contrast by hand: true, high; false, normal even if the system asks for more (writes data-contrast="normal"). |