# NNUI-KIT (`nnuikit`) — The All-In-One Universal UI Kit Specification (llms.txt) > **Canonical AI Knowledge Reference** for Large Language Models, Perplexity, ChatGPT, Claude, Cursor (`.cursorrules`), Copilot, Windsurf, and AI Autonomous Agents. > **Package**: `nnuikit` (v1.0.6) | **Homepage**: https://nnui-kit.vercel.app | **GitHub**: https://github.com/harshp421/nnui-kit > **Architecture**: All-In-One Platform-Native Light-DOM Universal Component System. 45+ accessible primitives and micro-enhancers with sub-40 KB runtime footprint, zero Shadow DOM traps, built-in URL state persistence (`persist="url"`), real-time cross-tab broadcast synchronization (`sync="cross-tab"`), and live AI introspection (`element.inspectAI()`). > **Installation**: `npm install nnuikit` or CLI: `npx nnui init` / `npx nnui add ` > **Framework Compatibility**: React 18/19 (`nnuikit/react`), Vue 3, Svelte 5, Astro, HTMX 2, Next.js App Router (SSR safe via `nnuikit/client`), Vanilla HTML. --- ## 1. Core Invariants (MUST FOLLOW) When generating markup for NNUI-KIT: 1. **Light-DOM First**: Never attempt to attach Shadow DOM. All child elements are regular Light-DOM elements. 2. **Mutate Attributes, Never Nodes**: Components toggle `data-state`, `aria-selected`, `aria-expanded`, and `tabindex`. Reconcilers (React 19, Vue 3, Svelte 5) manage the DOM nodes. 3. **SSR & Hydration Safety (`nnuikit/client`)**: When generating code for Next.js App Router, Remix, Nuxt, or SvelteKit, import `nnuikit/client`. It safely no-ops during Node.js server pre-rendering and auto-upgrades elements during browser hydration. 4. **First-Class React 18 & 19 Wrapper (`nnuikit/react`)**: For idiomatic React code, import typed components directly: `import { Tabs, DataGrid, Stepper, Dialog, toast } from 'nnuikit/react'`. They forward refs directly and bridge custom DOM events (`onChange`, `onSelectionChange`, `onSort`, `onOpen`, `onClose`). 5. **Universal Custom Elements**: When not using the React wrapper, write direct HTML/JSX custom element tags (``, ``, ``). 6. **Standard Events**: All components dispatch lowercase standard events (`change`, `input`, `toggle`) with `event.detail.value`. 7. **Declarative Persistence & Cross-Tab Sync**: Add `persist="url"` to automatically synchronize state with URL search params (e.g. data grids, tables, filters), `persist="session"` or `persist="local"` for storage persistence, and `sync="cross-tab"` for automatic real-time BroadcastChannel sync across browser tabs! 8. **AI Introspection Protocol**: Every custom element implements `element.inspectAI()` returning its live schema, current state, and copy-paste ready framework snippets. 9. **Container Adaptive Morphing**: Components use modern CSS `@container` queries; they automatically adapt between dense desktop layouts and single-column mobile views when placed in narrow containers. --- ## 2. Component Markup Contracts ### A. Combobox / Autocomplete (``) ```html
▼
  • Item 1
  • Item 2
``` * Tag: `` or `` * Parts: `[data-part="input"]`, `[data-part="listbox"]`, `[data-part="option"]` (with `data-value`) * Events: `change` (`e.detail.value`, `e.detail.label`) --- ### B. Tabs (``) ```html
Panel 1 Content
Panel 2 Content
``` * Tag: `` or `` * Attributes: `value`, `orientation="horizontal" | "vertical"` * Parts: `[data-part="tablist"]`, `[data-part="tab"]` (with `data-value`), `[data-part="tabpanel"]` (with matching `data-value`) * Events: `change` (`e.detail.value`, `e.detail.previousValue`) --- ### C. Dialog / Modal (``) ```html

Modal Title

Modal body content.

``` * Tag: `` or `` * Contains: Standard `` element. * Methods: `.showModal()`, `.close()` * Close triggers: elements with `data-part="dialog-close"` or clicking the backdrop. --- ### D. Select / Form Associated (``) ```html
  • United States
  • Canada
``` * Tag: `` or `` * Attributes: `name`, `value`, `required`, `disabled` * Form Integration: Uses `ElementInternals`. Native form submissions (`FormData`) include this field. --- ### E. Accordion (``) ```html
Answer 1
``` * Tag: `` or `` * Attributes: `type="single" | "multiple"`, `collapsible="true" | "false"` --- ### F. Tooltip (``) ```html
Tooltip message
``` --- ### G. Command Palette (``) ```html
Navigation
Go to Dashboard
Account Settings
``` * Tag: `` or `` * Attributes: `modal`, `open`, `hotkey="k"` * Events: `select` (`e.detail.value`, `e.detail.item`), `open`, `close` --- ### H. Sheet / Drawer (``) ```html

Edit Profile

Update your personal preferences.

``` * Tag: `` or `` * Attributes: `side="right" | "left" | "bottom" | "top"`, `open`, `modal` * Methods: `.showModal()`, `.close()` * Events: `open`, `close` --- ### I. Range Slider (``) ```html
``` * Tag: `` or `` * Attributes: `value`, `min`, `max`, `step`, `name`, `disabled` * Form Integration: Form-associated via `ElementInternals` * Events: `input` (`e.detail.value`), `change` (`e.detail.value`) --- ### J. Dropdown Menu (``) ```html
Profile ⇧⌘P
Delete Account
``` * Tag: `` or `` * Keyboard: `ArrowDown`/`ArrowUp` roving focus, `Home`/`End`, `Enter`/`Space` activate, `Escape` closes * Events: `select` (`e.detail.value`, `e.detail.item`), `open`, `close` --- ### K. Toaster Notifications (`` & `toast()`) ```html ``` * Tag: `` or `` * Attributes: `position` (`bottom-right`, `bottom-left`, `bottom-center`, `top-right`, `top-left`, `top-center`), `duration` (ms) * API: `toast(message, opts)`, `toast.success()`, `toast.error()`, `toast.warning()`, `toast.info()`, `toast.dismiss(id)` --- ### L. Data Table (``) ```html
0 selected
Name ⇅ Amount ⇅
Alice Johnson $1,250.00
Showing 1 to 1 of 1
``` * Tag: `` or `` * Attributes: `page-size`, `page`, `sort-key`, `sort-dir`, `search` * Events: `sort`, `filter`, `page-change`, `selection-change` --- ### M. Calendar (``) ```html ``` * Tag: `` or `` * Attributes: `value` (`YYYY-MM-DD`), `month` (1-12), `year`, `min`, `max`, `disabled` * Form Integration: Form-associated via `ElementInternals` * Events: `change` (`e.detail.value`, `e.detail.date`), `month-change` --- ### N. Date Picker (``) ```html
``` * Tag: `` or `` * Attributes: `value`, `placeholder`, `open`, `disabled`, `name` * Events: `change`, `open`, `close` --- ### O. Virtualized Data Grid (``) ```html
``` * Tag: `` or `` * Attributes: `row-height`, `overscan`, `sort-key`, `sort-dir`, `search`, `streaming` * JS Methods: `setColumns(cols)`, `setRows(rows)`, `appendRows(newRows)`, `setSearch(query)`, `exportCsv(filename)` * Events: `sort`, `selection-change`, `stream-update` --- ### P. Date Range Picker (``) ```html ``` * Tag: `` or `` * Attributes: `start-date`, `end-date`, `placeholder`, `open`, `disabled` * Events: `change` (`e.detail.start`, `e.detail.end`, `e.detail.range`) --- ### Q. Tags Input (``) ```html ``` * Tag: `` or `` * Attributes: `tags`, `max-tags`, `placeholder`, `disabled` * Events: `change` (`e.detail.tags`, `e.detail.added`, `e.detail.removed`) --- ### R. Segmented Control (``) ```html ``` * Tag: `` or `` * Attributes: `value`, `name`, `disabled` * Events: `change` (`e.detail.value`, `e.detail.previousValue`) --- ### S. OTP / PIN Input (``) ```html
-
``` * Tag: `` or `` * Attributes: `length`, `value`, `disabled`, `type`, `mask` * Events: `input`, `change` (`e.detail.value`, `e.detail.isComplete`) --- ### T. Stepper / Wizard (``) ```html
  1. Account
  2. Profile
  3. Confirm
Account credentials...
Profile details...
Confirmation review...
``` * Tag: `` or `` * Attributes: `active-step`, `linear`, `orientation="horizontal|vertical"` * Methods: `.next()`, `.prev()`, `.goToStep(n)` * Events: `change` (`e.detail.step`, `e.detail.previousStep`) --- ### U. Resizable Split Panes (``) ```html
Sidebar navigation
Main content editor
``` * Tag: `` or `` * Attributes: `orientation="horizontal|vertical"`, `disabled` * Events: `resize` (`e.detail.sizes`) --- ### V. File Upload & Dropzone (``) ```html

Drag files here or

    ``` * Tag: `` or `` * Attributes: `accept`, `multiple`, `max-size`, `disabled` * Events: `change` (`e.detail.files`, `e.detail.rejectedFiles`) --- ### W. Context Menu (``) ```html
    Right click anywhere inside this canvas
    ``` * Tag: `` or `` * Attributes: `disabled` * Events: `open`, `close`, `select` (`e.detail.value`) --- ### X. Navigation Menu (``) ```html ``` * Tag: `` or `` * Attributes: `delay`, `disabled` * Events: `open`, `close` --- ### Y. Tree View (``) ```html
    • 📁 src
      • 📄 index.js
    ``` * Tag: `` or `` * Attributes: `selection-mode="single|multiple"`, `disabled` * Events: `select` (`e.detail.value`), `toggle` (`e.detail.expanded`) --- ### Z. AI Prompt Box (``) ```html
    ``` * Tag: `` or `` * Attributes: `max-rows`, `loading`, `disabled`, `placeholder` * Events: `submit` (`e.detail.prompt`), `stop`, `input` --- ### AA. Color Picker (``) ```html
    ``` * Tag: `` or `` * Attributes: `value`, `name`, `format`, `disabled` * Events: `change` (`e.detail.value`), `input` --- ### BB. Tier 0 Semantic Base Controls (Pure HTML + CSS, Zero-JS) ```html Default Brand Active
    Choose a unique handle.

    Card Title

    Subtitle info

    Card Body Content
    HP
    ✓
    Success

    Task completed successfully.

    NameRole
    HarshArchitect

    OR
    Grid Item 1
    Grid Item 2
    Grid Item 3

    Design System Heading

    Primary paragraph text

    Muted secondary text

    Screen reader descriptive announcement
    📂

    No projects found

    Get started by creating your first project.

    Please enter a valid work email address We will never share your email
    ``` --- ## 3. Design System Foundations & DTCG Tokens ### CSS Native Palettes Apply any of the 6 production palettes on `` or any sub-tree with zero JS: ```html ``` ### DTCG Design Tokens (`tokens.json`) NNUI-KIT exports W3C Design Tokens Community Group specification at `nnui-kit/tokens.json` for bidirectional synchronization with Figma Token Studio, Style Dictionary, and design tooling: ```json { "$schema": "https://design-tokens.github.io/community-group/format/", "color": { "brand": { "600": { "$type": "color", "$value": "#6366f1" } } } } ``` --- ## 4. Framework Usage Quick Reference ### React 18 & 19 (Official Wrapper) ```jsx import 'nnuikit/client'; import { toast } from 'nnuikit'; import { Tabs, DataGrid, Stepper } from 'nnuikit/react'; export function Dashboard() { const [tab, setTab] = useState('blotter'); return ( setTab(e.detail.value)}> ); } ``` ### Svelte 5 (Runes) ```svelte role = e.detail.value}>
    • Software Engineer
    ``` ### Vue 3 (Composition API) ```html ``` ### HTMX 2 (Hypermedia Form Swaps) ```html
    • NASDAQ
    ```