Core
@xngui/core@xngui/coreShared types, capability contracts, runtime bootstrap (config · i18n · errors · logging), and storage keys.
Overview
Fourteen Categories Types Capabilities Runtime Entry Points
- 1Visual
types/visual.ts - 2Size
types/size.ts - 3Tokens
types/tokens.ts - 4Layout
types/layout.ts - 5State
types/state.ts - 6Interaction
types/interaction.ts - 7Capabilities
types/capabilities.ts - 8Form
types/form.ts - 9Typography
types/typography.ts - 10Events
types/events.ts - 11Data
types/data.ts - 12Media
types/media.ts - 13Runtime
config · i18n · errors · files · logging - 14Settings
storage/keys.ts
imports.tsimport type { XVariant, XSize, XPlacement, XDataQuery, XChangeEvent, XOpenBound,} from '@xngui/core';import { X_STORAGE_KEYS } from '@xngui/core/storage';import { provideX } from '@xngui/core/config';- Visual
types/visual.tsSemantic Variants And Surface Treatments
XVariantXColorXAppearance - Size
types/size.tsControl Scale And Intrinsic Sizing Keywords
XSizeXWidthXHeight - Tokens
types/tokens.tsPrimitive Steps Aligned With Xngui Styles
XSpacingStepXRadiusStepXShadowStepXSemanticToken - Layout
types/layout.tsFlex And Overlay Placement
XOrientationXAlignXJustifyXPlacementXPositionXTextAlignXTextDirection - State
types/state.tsContracts And Feedback Status
XDisabledXLoadingModeXStatusXVisibility - Interaction
types/interaction.tsTriggers Activation Scroll
XTriggerXActivationXButtonTypeXScrollStrategyXFocusOriginXAriaLive - Capabilities
types/capabilities.tsSignal Implements Contracts For Components
XDisableableXLoadingXOpenBoundXPaginatedXKeySelectionXToastHost - Form
types/form.tsOptions Validation And Form Chrome
XOptionXLabelModeXFormLookXValidateOnXValidationState - Typography
types/typography.tsType Scale And Text Treatment Unions
XTextSizeXFontWeightXTextTransformXTextOverflow - Events
types/events.tsComponent Output Payloads
XChangeEventXClickEventXSelectionEventXPageEventXSortEventXFocusEventXBlurEvent - Data
types/data.tsHeadless Data Pipeline
XDataQueryXDataResultXDataLoaderXDataStatusXFilterXSortXSelectionState - Media
types/media.tsAdornments Avatars And Media Fit
XIconPositionXIconSizeXAvatarShapeXImageFit - Runtime
config · i18n · errors · files · loggingSecondary Entry Points For App Bootstrap
provideXXConfigServiceXTranslationServiceXErrorHandlerServiceXFileService - Settings
storage/keys.tsCross Package Storage Keys
X_STORAGE_KEYSXLocalStorageServiceXIndexedDbService
Visual
XVarianttypeComponent Variant Input
primarysecondaryaccentdangersuccesswarninginfoXColortypePalette Token Family Key
primarysecondaryaccentneutralsuccesswarningdangerinfoXAppearancetypeSurface Treatment For Controls
solidoutlineghostsoftXDensitytypeStandard baseline; comfortable is roomier, compact is tighter chrome spacing.
compactcomfortablestandard
Xvariant Semantic Roles For Actions And Status Bearing Ui
Xappearance Surface Treatments Paired With Xvariant
solidoutlineghostsoftXcolor Includes Neutral For Chrome Unlike Xvariant
--x-primary--x-secondary--x-accent--x-neutral--x-success--x-warning--x-danger--x-infoSize
Five Steps Shared Across Buttons Inputs Chips And More
xsxssmsmmdmdlglgxlxl
XDensity adjusts spacing chrome only — padding, gap, and control height offsets — without changing type or icon size. Pair with XSize on interactive components. Live CSS tokens are documented on the control scale on the Styles page.
XDensity · compactXDensity · comfortableXDensity · standardLayout
Xorientation
Xalign
Xjustify
Xposition
Xtextalign
Xtextdirection
Xoverlaylayer
Xplacement Twelve Anchored Positions For Overlays Tooltips And Menus
Xorientation Xalign Xjustify In Context
Horizontal Center CenterHorizontal End BetweenVertical Stretch StartVertical Center EvenlyXtextdirection LtrLogical start is on the left — inline flow follows reading order.
Xtextdirection RtlLogical start is on the right — inline flow mirrors for RTL locales.
State
XDisabledinterfaceDisabled Boolean Contract
XLoadingModetypespinneroverlayreplaceXStatustypeneutralinfosuccesswarningdangerXVisibilitytypevisiblehidden
XDisabled: falseXDisabledXLoadingInteraction
Xtrigger
Xactivation
Xselectionmode
Xbuttontype
Xscrollstrategy
Xfocusorigin
Xarialive
Form
Xlabelmode
Xformlook
Xinputtype
Xvalidateon
Xvalidationstate
Events
Component Output Handlers Never Raw Event Unless Wrapped
XChangeEvent<T>{ value, previousValue? }event.ts{ "value": "dark", "previousValue": "light" }XClickEvent<T>{ originalEvent }event.ts{ "originalEvent": "PointerEvent" }XSelectionEvent<T>{ added, removed }event.ts{ "added": ["a"], "removed": [] }XPageEvent{ pageIndex, pageSize, length }event.ts{ "pageIndex": 0, "pageSize": 25, "length": 120 }XSortEvent{ sort }event.ts{ "sort": { "active": "name", "direction": "asc" } }XFocusEvent{ origin }event.ts{ "origin": "keyboard" }XBlurEvent{ originalEvent? }event.ts{ "originalEvent": "FocusEvent" }
Data
- QueryXdataquery Page Sort Filter Snapshot
- LoaderXdataloader T Sync Or Async With Abortsignal
- ResultXdataresult T Items Total Count
- StatusXdatastatus Idle Loading Success Error
Xdataquery
query.ts{ "pageIndex": 0, "pageSize": 25, "sort": { "active": "name", "direction": "asc" }, "filter": null}Xdataresult
result.ts{ "items": ["Row A", "Row B", "Row C"], "total": 120}Xsortdirection
Xdatastatus
Xfilterlogic
Xselectionstate
Xcolumnalign
Xemptystatetype
Capabilities
Components Opt Into Shared Behavior With
XDisableableinterfaceDisabled Input Group Parents May Pass Undefined To Inherit
XLoadinginterfaceLoading Input With Aria Busy Semantics
XOpenBoundinterfaceDeclarative Overlays Dialog Drawer Alert Dialog
XAnchorBoundinterfaceFloating Surfaces Anchored To An Origin Menu Popover
XPaginatedinterfacePage Index Size With Navigation Helpers
XKeySelectioninterfaceString Key Selection For Tables And Lists
XSortableinterfaceColumn Sort Stack For Data Tables
XToastHostinterfaceImperative Toast Queue Api
XPlaybackinterfaceNative Audio Video Playback Controls
Tokens
Structural and semantic token steps are typed in @xngui/core. Use the unions in component APIs and tools like the theme builder — not stringly-typed CSS variable names.
XColor--x-{role}Semantic color roles — bind component variant inputs to theme slots instead of hard-coded hues.
- CSS token
color: var(--x-primary); - Component input
<x-badge variant="danger" /> - Tailwind utility
<div class="bg-primary text-primary-foreground">
- CSS token
XSize[data-size]Visual tier on interactive hosts — resolves to control height, type, and radius tokens.
- Host attribute
<x-button size="lg" /> - Resolved token
--x-control-height: var(--x-size-height-lg); - CSS selector
x-input[data-size="sm"] { … }
- Host attribute
XDensity[data-density]Padding and gap offsets — orthogonal to size; never changes type or icon scale.
- Host attribute
<x-button density="compact" /> - Resolved token
--x-control-pad-inline: calc(var(--x-scale-pad-inline) + var(--x-density-offset-pad-inline)); - Config default
provideX({ config: { density: 'comfortable' } })
- Host attribute
XSemanticToken--x-{token}Named surface and chrome slots — background, card, border, ring, and related page chrome.
- Page canvas
background: var(--x-background); - Elevated surface
background: var(--x-card); border-color: var(--x-card-border); - Type union
type XSemanticToken = 'background' | 'card' | 'border' | …
- Page canvas
XSpacingStep--x-spacing-{n}Tailwind-aligned spacing scale — 4px base unit.
- Gap
gap: var(--x-spacing-4); - Margin
margin-block: var(--x-spacing-6); - Component input
<x-stack gap="3" />
- Gap
XRadiusStep--x-radius-{step}Corner radius tiers from extra-small through full pill.
- Card chrome
border-radius: var(--x-radius-lg); - Chip or badge
border-radius: var(--x-radius-full); - Type union
type XRadiusStep = 'xs' | 'sm' | … | 'full'
- Card chrome
XShadowStep--x-shadow-{step}Elevation shadows — oklch-based and theme-aware.
- Popover
box-shadow: var(--x-shadow-lg); - Component input
<x-card shadow="md" /> - Type union
type XShadowStep = 'sm' | 'md' | 'lg' | 'xl' | '2xl'
- Popover
XDurationStep--x-duration-{step}Motion duration steps — respect prefers-reduced-motion globally.
- Transition
transition-duration: var(--x-duration-fast); - Animation
animation-duration: var(--x-duration-normal); - Type union
type XDurationStep = 'fast' | 'normal' | 'slow'
- Transition
XOverlayLayer--x-z-{layer}Stacking layers for overlays — modal above popover above sticky chrome.
- Dialog
z-index: var(--x-z-modal); - Config override
provideX({ config: { zIndex: { modal: 60 } } }) - Type union
type XOverlayLayer = 'dropdown' | 'modal' | …
- Dialog
XTextSize--x-text-{size}Type scale with paired leading — set both when using primitives directly.
- Font size
font-size: var(--x-text-sm); - Paired leading
line-height: var(--x-text-sm-leading); - Component
<x-text size="lg">…</x-text>
- Font size
XFontWeight--x-weight-{weight}Weight steps from thin through black.
- CSS
font-weight: var(--x-weight-semibold); - Component
<x-text weight="medium">…</x-text> - Type union
type XFontWeight = 'normal' | 'medium' | 'bold' | …
- CSS
Align With Xngui Styles Primitives
Xspacingstep
Xradiusstep
Xshadowstep
Xdurationstep
Xsemantictoken
Typography
Xtextsize
Xfontweight
Xtexttransform
Xtextoverflow
Runtime
Providex From Xngui Core Config Registers
app.config.tsimport { provideX } from '@xngui/core/config';export const appConfig = { providers: [ provideX({ config: { size: 'md', validateOn: 'touched' }, locale: 'en-US', }), ],};Override Once Via
- size
mdXSize- density
standardXDensity- variant
primaryXVariant- appearance
outlineXAppearance- labelMode
staticXLabelMode- look
outlineXFormLook- validateOn
touchedXValidateOn- ripple
trueboolean- animate
trueboolean- overlay.placement
bottom-startXPlacement- overlay.closeOnEscape
trueboolean- overlay.closeOnOutside
trueboolean
- @xngui/core/config
Library Wide Defaults Size Density Validateon Z Index Layers
provideXprovideXConfigXConfigServiceXConfig - @xngui/core/i18n
Flat Translation Keys Locale Persistence And Intl Formatters
XLocaleServiceXTranslationServiceXIntlServiceXTranslatePipeprovideXTranslations - @xngui/core/direction
Runtime Ltr Rtl With Persisted Preference
XDirectionService - @xngui/core/errors
Domain Errors And A Pluggable Global Handler
provideXErrorHandlerXErrorHandlerServiceXComponentError - @xngui/core/files
Pick Extract Validate Read And Download Browser Files
XFileServiceXBrowserFileServicevalidateFilesdownloadTextpickFiles - @xngui/core/logging
Structured Logging With Injectable Backends
provideXLoggerXLoggerServiceXLogger - @xngui/core/storage
SSR-safe localStorage and IndexedDB helpers plus shared persistence keys.
XLocalStorageServiceXIndexedDbServiceX_STORAGE_KEYS
Storage
Use XLocalStorageService for string preferences and XIndexedDbService for larger structured state. Both swallow storage failures and no-op during SSR.
storage.tsimport { inject } from '@angular/core';import { XLocalStorageService, X_STORAGE_KEYS } from '@xngui/core/storage';const storage = inject(XLocalStorageService);storage.set(X_STORAGE_KEYS.theme, 'dark');storage.get(X_STORAGE_KEYS.theme); // → 'dark'storage.remove(X_STORAGE_KEYS.theme);indexed-db.tsimport { inject } from '@angular/core';import { XIndexedDbService } from '@xngui/core/storage';const db = inject(XIndexedDbService);await db.open('my-app', { version: 1, stores: [{ name: 'drafts', keyPath: 'id' }],});await db.set('my-app', 'drafts', 'page-1', { title: 'Notes' });const draft = await db.get<{ title: string }>('my-app', 'drafts', 'page-1');- Storage Theme
x-theme- Storage Theme Palette
x-theme-palette- Storage Locale
x-locale- Storage Direction
x-direction- X Storage Keys
x-config
Media
Xiconposition
startendXavatarshape
circlesquarerounded