Zinc
Slate
Violet
Rose
Emerald
Blue
Orange
Star
ESC
Components (51)
AccordionTier 2: Micro-EnhancerAI Prompt BoxTier 2: Micro-EnhancerAlertTier 0: Pure HTMLAvatarTier 0: Pure HTMLBadgeTier 0: Pure HTMLButtonTier 0: Pure HTMLCalendarTier 2: Micro-EnhancerCardTier 0: Pure HTMLCheckbox & RadioTier 0: Pure HTMLColor PickerTier 2: Micro-EnhancerComboboxTier 2: Micro-EnhancerCommand PaletteTier 2: Micro-EnhancerContext MenuTier 2: Micro-EnhancerVirtualized Data GridTier 2: Micro-EnhancerData TableTier 2: Micro-EnhancerDate PickerTier 2: Micro-EnhancerDate Range PickerTier 2: Micro-EnhancerDialogTier 2: Micro-EnhancerDropdown MenuTier 2: Micro-EnhancerFile Upload & DropzoneTier 2: Micro-EnhancerInput & FieldTier 0: Pure HTMLNavigation MenuTier 2: Micro-EnhancerOTP / PIN InputTier 2: Micro-EnhancerPopoverTier 2: Micro-EnhancerProgressTier 0: Pure HTMLResizable Split PaneTier 2: Micro-EnhancerSegmented ControlTier 2: Micro-EnhancerSelectTier 2: Micro-EnhancerSeparatorTier 0: Pure HTMLSheet / DrawerTier 2: Micro-EnhancerSkeletonTier 0: Pure HTMLSliderTier 2: Micro-EnhancerStepper / WizardTier 2: Micro-EnhancerSwitchTier 0: Pure HTMLTableTier 0: Pure HTMLTabsTier 2: Micro-EnhancerTags InputTier 2: Micro-EnhancerToast / ToasterTier 2: Micro-EnhancerTooltipTier 2: Micro-EnhancerTree ViewTier 2: Micro-EnhancerSpinnerTier 0: Pure HTMLEmpty StateTier 0: Pure HTMLStackTier 0: Pure HTMLGridTier 0: Pure HTMLContainerTier 0: Pure HTMLSparklineTier 2: Micro-EnhancerDockTier 2: Micro-EnhancerTimelineTier 2: Micro-EnhancerAI ReasoningTier 2: Micro-EnhancerAI Tool CallTier 2: Micro-EnhancerAI Approval GateTier 2: Micro-Enhancer

Introduction & Architecture

NNUI-KIT is a platform-native, three-tier Light-DOM universal UI system. It delivers accessible, composable interface components that execute identically across every modern web framework with zero Shadow DOM barriers and sub-40 KB runtime footprint.

AEOAt a Glance: The Universal Light-DOM Principle

NNUI-KIT solves the web component dilemma by keeping all elements in the Light DOM while using custom elements strictly as behavioral micro-enhancers that "Mutate Attributes, Never Nodes". This gives you 100% code ownership, zero Shadow DOM accessibility traps, native form participation, and seamless compatibility with React 19, Vue 3, Svelte 5, Astro, and SSR frameworks.

Three-Tier Architecture

Tier 0: Pure Semantic Primitives (17 Zero-JS Controls)Zero JS

Buttons, Badges, Inputs, Checkboxes, Switches, Cards, Skeletons, Dividers, Grid & Stack layouts. Render instantly via CSS Cascade Layers (@layer ui.base).

Tier 1: Design Tokens & CSS Cascade LayersW3C DTCG

W3C DTCG tokens specification with 7 color palettes (Zinc, Slate, Violet, Blue, Emerald, Rose, Orange). Layered defensively across @layer ui.tokens, ui.base, ui.components, ui.overrides.

Tier 2: Micro-Enhancers (28 Light-DOM Custom Elements)Sub-40 KB

Virtualized Data Grid (>15k rows), Date Range Picker, Combobox, Dialog, Stepper, AI Prompt Box, Tabs. 100% Light-DOM custom elements with ElementInternals form association.

Why Light-DOM? (Solving Shadow DOM Traps)

Traditional Web Component libraries seal templates inside closed Shadow DOM roots. While isolation sounds good initially, it creates severe accessibility, styling, and form participation bottlenecks in production applications:

DimensionShadow DOM LibrariesNNUI-KIT (Light-DOM)
Global CSS & TailwindBlocked by boundary (requires ::part())Directly styled by standard classes & @layer cascade
Form ParticipationRequires synthetic hidden input injection hacksNative ElementInternals & FormData auto-serialization
Screen Readers (A11y)Fragmented accessibility tree; broken aria-labelledby IDsUnbroken DOM tree; standard document ID references
Framework V-DOMHydration mismatch and node duplication conflicts"Mutate Attributes, Never Nodes" — 100% V-DOM safe

Installation & Setup

Install via npm or use the registry CLI to drop zero-dependency custom elements and copy-pasteable CSS theme tokens directly into your project:

Looking for framework-specific installation guides?

View dedicated step-by-step guides for Vite (React), Next.js 15, Astro, Vue 3, Svelte 5, Remix, and Vanilla HTML.

Select Your Framework →
# 1. Install universal package
npm install nnuikit

# 2. Or initialize the CLI (automatically generates theme.css and tokens in your app)
npx nnuikit init

# 3. Add components with your specific framework target:
npx nnuikit add dialog --react   # Drops React compound component into src/components/ui/
npx nnuikit add dialog --html    # Drops vanilla HTML snippet & JS micro-enhancer
npx nnuikit add dialog --rails   # Drops Rails ERB partial & configures importmap.rb
🚀Framework Targets: True Code Ownership Across Stacks
CLI v1.0.8

Unlike shadcn/ui (locked to React) or traditional web components (locked in Shadow DOM), NNUI-KIT provides 100% Light-DOM code ownership across modern frontend and server-rendered stacks. Run the CLI with your framework target:

# Drops React 18/19 compound component into src/components/ui/dialog.jsx
npx nnuikit add dialog --react

// In your application:
import { Dialog, DialogModal } from './components/ui/dialog.jsx';

export function Example() {
  return (
    <DialogModal open={isOpen} onClose={() => setIsOpen(false)} title="Confirm Release">
      <p>You own the markup and internals!</p>
    </DialogModal>
  );
}

Exports raw primitives, typed compound subcomponents (Dialog.Trigger, Dialog.Content, Dialog.Close), and an editable composite modal.

# Drops runnable HTML snippet & JS micro-enhancer into components/ui/dialog/
npx nnuikit add dialog --html

<!-- components/ui/dialog/dialog.html -->
<ui-dialog id="my-modal">
  <button data-part="trigger" type="button">Open Modal</button>
  <dialog data-part="dialog">
    <div data-part="panel">
      <h3>Platform Top-Layer Modal</h3>
      <p>Zero build step, 100% accessible.</p>
      <button data-part="close" type="button">Close</button>
    </div>
  </dialog>
</ui-dialog>

<script type="module" src="./ui-dialog.js"></script>

Includes standalone micro-enhancer and semantic Light-DOM HTML snippet. Open directly in any browser.

# Generates ERB partial, asset pipeline JS, and pins nnuikit in importmap.rb
npx nnuikit add dialog --rails

<%# app/views/pages/home.html.erb %>
<%= render "components/dialog", id: "confirm-modal", title: "Canary Rollout" do %>
  <p>Rendered with native Rails ERB and Light-DOM web components.</p>
<% end %>

Creates app/views/components/_dialog.html.erb with local_assigns and block yields, and configures Rails Importmaps automatically.

🎨Theme & Global CSS Tokens (Turnkey Copy-Paste)
Theme Studio & Exporter →

NNUI-KIT provides standalone, W3C DTCG-compliant global CSS theme files. You can import them directly from the package, or copy-paste them straight into your product's globals.css or theme.css:

// Option 1: Full Universal Stylesheet (Cascade layers, tokens, reset & base primitives)
import 'nnuikit/globals.css';

// Option 2: Pure Theme Custom Properties (Zero-dependency CSS variables only)
import 'nnuikit/theme.css';

Want to customize brand color harmonies, light/dark modes, and border radii? Visit our Design Tokens & Theme Studio to test components in real time and copy or download your tailored CSS theme file with 1 click.

Crown Innovation: Declarative State Persistence

Zero Router Boilerplate

Eliminate hundreds of lines of router boilerplate by adding declarative persistence attributes directly to your markup. State automatically hydrates on page load and reflects live changes:

<!-- Automatically binds search, column sort, and pagination to URL query params -->
<ui-data-grid persist="url"></ui-data-grid>

<!-- Autosaves multi-step wizard step and form values to localStorage -->
<ui-stepper persist="local"></ui-stepper>

<!-- Saves unfinished user drafts in AI prompt box -->
<ui-ai-prompt-box persist="local"></ui-ai-prompt-box>

Cross-Tab Broadcast Synchronization

Zero Server / Zero WebSockets

Every NNUI-KIT micro-enhancer supports zero-config multi-tab synchronization powered by the native browser BroadcastChannel API. State updates in one tab instantly propagate to other open tabs:

<!-- Stepper synchronizes current active step across all open browser windows -->
<ui-stepper sync="cross-tab">
  <div data-part="step" data-title="Account">...</div>
  <div data-part="step" data-title="Profile">...</div>
  <div data-part="step" data-title="Review">...</div>
</ui-stepper>

<!-- Combine URL persistence and Cross-Tab sync simultaneously -->
<ui-data-grid persist="url" sync="cross-tab"></ui-data-grid>

AI Machine-Readable Introspection Protocol

nnui.ai.v1

Every micro-enhancer implements the nnui.ai.v1 introspection protocol. Autonomous AI agents (Cursor, Claude, Copilot, Antigravity) and developer tooling can query live element state and request copy-ready framework snippets at runtime:

const element = document.querySelector('ui-data-grid');
const schema = await element.inspectAI();

console.log(schema.protocol);          // "nnui.ai.v1"
console.log(schema.schema.parts);      // ["toolbar", "search", "export-btn", "table", "pagination"]
console.log(schema.liveState);         // Active rows, sort column, search query
console.log(schema.frameworkSnippets); // Idiomatic React 19, Vue 3, Svelte 5 snippets
🤖 Using Cursor, Copilot, or Claude? Use llms.txt

Copy the standardized specification so your AI assistant writes 100% accurate NNUI-KIT code without hallucinations.

View & Copy llms.txt →

React 18 & 19 (Next.js 15 App Router)

First-Class Typed Wrappers

NNUI-KIT provides official React 18 & 19 bindings exported from nnuikit/react. Built with forward-ref semantics, TypeScript interfaces, and Next.js 15 App Router SSR safety:

app/dashboard/page.tsx
'use client';

import React, { useState } from 'react';
import 'nnuikit/css';
import 'nnuikit/client';
import { Button, Card, Input, Badge } from 'nnuikit/react';

export default function DashboardPage() {
  const [email, setEmail] = useState('');

  return (
    <main style={{ minHeight: '100vh', padding: '2rem', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <Card style={{ width: '100%', maxWidth: '440px', padding: '1.75rem', display: 'flex', flexDirection: 'column', gap: '1rem' }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
          <h1 style={{ margin: 0, fontSize: '1.25rem', fontWeight: 700 }}>Customer Intelligence</h1>
          <Badge variant="success">Active</Badge>
        </div>

        <p style={{ margin: 0, color: 'var(--ui-text-secondary, #a1a1aa)', fontSize: '0.875rem' }}>
          Platform-native Light-DOM UI primitives with React 18 & 19 typed wrappers.
        </p>

        <Input 
          placeholder="Enter user email..." 
          value={email} 
          onChange={(e) => setEmail(e.target.value)} 
        />

        <Button variant="primary" onClick={() => alert(`Saved: ${email}`)}>
          Save Profile
        </Button>
      </Card>
    </main>
  );
}
💡React Styling Best Practices & Common Gotchas
  • Automatic Canvas & Body Theming:nnuikit/css automatically binds html, body to the canvas background (--ui-bg-canvas) and text colors. You do not need to write manual body { background-color: ... } rules.
  • Avoid * { padding: 0 }: Unlayered universal resets override CSS Cascade Layers and strip internal paddings from buttons, tabs, and accordions. Use standard modern box-sizing:*, *::before, *::after { box-sizing: border-box; } body { margin: 0; }.
  • Flexbox Column Button Alignment: Flex containers withflex-direction: column default to align-items: stretch. Wrap action buttons in an action row (e.g. <div style={{ display: 'flex', gap: '0.75rem' }}>) or use align-self: flex-start so buttons stay at their natural width.

Svelte 5 (Runes Architecture)

Zero Runtime Overhead

Because Svelte compiles directly to native DOM operations without a virtual DOM overhead, NNUI-KIT's Light-DOM architecture integrates natively with Svelte 5 Runes ($state, $derived, $effect):

src/routes/+page.svelte
<script>
  import 'nnuikit/css';
  import 'nnuikit/client';

  let activeStep = $state(1);
  let stepperEl = $state();

  function handleStepChange(event) {
    activeStep = event.detail.step;
  }
</script>

<!-- Universal Light-DOM Web Component directly driven by Svelte 5 Runes -->
<ui-stepper 
  bind:this={stepperEl} 
  step={activeStep} 
  sync="cross-tab" 
  on:step-change={handleStepChange}
>
  <div data-part="step" data-title="General Info">Step 1 Content</div>
  <div data-part="step" data-title="Permissions">Step 2 Content</div>
  <div data-part="step" data-title="Review">Step 3 Confirmation</div>
</ui-stepper>

Vue 3 & Nuxt 3 (Composition API)

Custom Element Native

Configure your Vite or Nuxt 3 config to treat ui-* and nnui-* tags as custom elements, then use them directly in Vue templates with<script setup>:

vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          // Treat all ui-* and nnui-* tags as universal Light-DOM elements
          isCustomElement: (tag) => tag.startsWith('ui-') || tag.startsWith('nnui-')
        }
      }
    })
  ]
});
src/components/CommandPalette.vue
<script setup>
import { ref } from 'vue';
import 'nnuikit/css';
import 'nnuikit/client';

const selectedItem = ref('');

const onSelect = (e) => {
  selectedItem.value = e.detail.value;
};
</script>

<template>
  <ui-command @command-select="onSelect">
    <input data-part="command-input" placeholder="Type a command or search..." />
    <div data-part="command-list">
      <div data-part="command-item" data-value="billing">Billing Settings</div>
      <div data-part="command-item" data-value="team">Team Members</div>
    </div>
  </ui-command>
</template>

HTMX 2 & Backend SSR

Django · Rails · Laravel · Go

Shadow-DOM libraries fail catastrophically with HTMX because HTML fragment swaps destroy sealed shadow boundaries. NNUI-KIT's pure Light-DOM architecture automatically re-initializes swapped nodes and participates in native <form> submissions via ElementInternals:

templates/dashboard.html
<!-- 1. Load Universal NNUI-KIT bundle in <head> -->
<link rel="stylesheet" href="https://unpkg.com/nnuikit/dist/theme.css">
<script type="module" src="https://unpkg.com/nnuikit/dist/client.js"></script>
<script src="https://unpkg.com/htmx.org@2.0.0"></script>

<!-- 2. Trigger dynamic backend partial swap with HTMX -->
<ui-dialog id="modal-container">
  <button 
    data-part="trigger" 
    data-ui="button" 
    hx-get="/users/42/edit" 
    hx-target="#dialog-body" 
    hx-swap="innerHTML"
  >
    Edit User 42
  </button>

  <dialog data-part="dialog">
    <div data-part="dialog-header">
      <h3 data-part="dialog-title">Edit User Profile</h3>
    </div>
    <div id="dialog-body" data-part="dialog-body">
      <!-- Swapped dynamically by Django / Rails / Laravel / Go -->
      <div data-ui="skeleton" style="height: 120px;"></div>
    </div>
  </dialog>
</ui-dialog>

Typography System

Open Interactive Studio ↗

Proportional type scale with optical letter-spacing, fluid font hierarchies, and standardized semantic text roles. Zero Shadow DOM barriers, rendering instantly with pure semantic HTML:

Display 2XL — Enterprise Systems
Heading XL — Feature Modules
Heading LG — Section Header

Lead Paragraph: High visual hierarchy introduction text for hero sections.

Body Paragraph: Standard content typography optimized for sustained reading comprehension.

Muted Text: Secondary metadata, timestamps, and contextual captions.

typography-example.html
<!-- Headings with optical tracking -->
<h1 data-ui="heading" data-size="2xl">Dashboard Analytics</h1>
<h2 data-ui="heading" data-size="lg">Recent Activity</h2>

<!-- Standardized Text Roles -->
<p data-ui="text" data-variant="lead">Overview of performance across all services.</p>
<p data-ui="text" data-variant="muted">Last updated 2 minutes ago.</p>
<code data-ui="text" data-variant="code">npm install nnuikit</code>

Layout & Status Primitives

Zero-JS structural primitives that establish clean visual hierarchy across applications:

Indeterminate Spinners
Accessible ARIA roles
📁
Empty State Primitive

data-ui="empty" zero-data feedback