Getting started
@xngui/components/button@xngui/components/buttonInstall @xngui, bootstrap with provideX(), import styles, and render your first component.
Installation
Add the core packages your app needs. Individual components are tree-shaken via flat entry imports.
terminalpnpm add @xngui/components @xngui/styles @xngui/theme @xngui/core @xngui/iconsPeer: Angular 22+. Zoneless change detection is recommended — call provideZonelessChangeDetection() in app.config.ts.
App bootstrap
Registers global defaults (size, density, validateOn), locale, logging, and error handling.
app.config.tsimport { ApplicationConfig, provideZonelessChangeDetection } from '@angular/core';import { provideRouter } from '@angular/router';import { provideX } from '@xngui/core/config';export const appConfig: ApplicationConfig = { providers: [ provideZonelessChangeDetection(), provideX({ config: { size: 'md', density: 'standard', validateOn: 'touched', }, locale: 'en-US', }), provideRouter(routes), ],};Styles & theme
Import foundation tokens once in your app global CSS. Add the icon font when using <x-icon>.
styles.css@import '@xngui/styles';@import '@xngui/icons/fontawesome';XThemeService toggles .dark on <html> (light / dark / system). XPaletteService applies primitive color ramps via a :root block in <head>. See Styles for the full API.
theme.tsimport { XPaletteService, XThemeService } from '@xngui/theme';inject(XThemeService).setMode('dark');inject(XPaletteService).setPalette('ocean');Ship your own ramp at bootstrap with provideXPalettes() — token keys may omit the -- prefix.
palettes.tsimport { provideXPalettes } from '@xngui/theme';provideXPalettes([ { id: 'brand', label: 'Brand', description: 'Company colors.', icon: '🎨', tokens: { 'x-primary-500': 'oklch(0.55 0.14 250)' }, },]);First component
Import the component class, add it to imports, and use the x- selector in your template.
app.tsimport { Component } from '@angular/core';import { XButton } from '@xngui/components/button';import { XIcon } from '@xngui/icons';@Component({ selector: 'app-root', imports: [XButton, XIcon], template: ` <x-button variant="primary"> <x-icon name="star" xStart > Get started <x-button> `,})export class App {}Flat imports
Category folders (actions/, forms/) organize source on disk only — never in the import path.
| Symbol | Import path |
|---|---|
XButton | @xngui/components/button |
XInput | @xngui/components/input |
XForm | @xngui/components/form |
XIcon | @xngui/icons |
XDataSource | @xngui/cdk/datasource |
XSize | @xngui/core |
provideX | @xngui/core/config |
XThemeService | @xngui/theme |
XPaletteService | @xngui/theme |
provideXPalettes | @xngui/theme |
Next steps
Signal Forms, x-form, and x-form-field composition.
CSS primitives, semantic roles, and interaction states.
Runtime appearance, palette presets, and custom brand ramps.
Shared unions, events, and app bootstrap.
XIcon, Font Awesome import, and size tokens.
Harnesses, specs, and configureXComponent for library contributors.
Tune tokens and export a CSS preset.
Interactive demos for every UI primitive.