Get Started
Drop two files into your project. That's it. No npm, no webpack, no config.
HTML
<link rel="stylesheet" href="nought.css">
<script src="nought.js"></script>
Or use a CDN (coming soon)
<link rel="stylesheet" href="https://unpkg.com/nought-ui/nought.css">
<script src="https://unpkg.com/nought-ui/nought.js"></script>
Nought uses custom elements — lightweight, SSR/RSC-compatible, progressively enhanced. Wrap your markup in <n-tabs>, <n-accordion>, etc. and interactivity is automatic. Works in React Server Components, Astro, plain HTML — everywhere.
Cards
Versatile content containers with optional hover effects.
Clean and minimal card component with hover effect.
New
Feature Card
With badge, title and description layout.
<div class="n-card n-card-hover">
<div class="n-card-header">Title</div>
<div class="n-card-body">Content</div>
<div class="n-card-footer">Footer</div>
</div>
API
CSS Custom Properties
Variable Role
--n-surfaceCard background
--n-border-lightCard border and dividers
--n-radius-lgCard border radius
--n-shadow-mdHover shadow
--n-transitionHover transition
Badges & Tags
Small status indicators and categorization labels.
Default
Success
Warning
Danger
Info
Solid
HTML
CSS
JavaScript
API
CSS Custom Properties
Variable Role
--n-primary / --n-primary-lightDefault badge colors
--n-success / --n-success-lightSuccess variant colors
--n-warning / --n-warning-lightWarning variant colors
--n-danger / --n-danger-lightDanger variant colors
--n-info / --n-info-lightInfo variant colors
--n-radius-fullBadge border radius (pill shape)
Alerts
Contextual feedback messages with semantic border accents.
This is a default informational alert.
Changes saved successfully!
Your session will expire in 5 minutes.
Failed to delete the resource. Please try again.
<div class="n-alert n-alert-success">
Changes saved successfully!
</div>
API
CSS Custom Properties
Variable Role
--n-primary / --n-primary-lightDefault alert accent and background
--n-success / --n-success-lightSuccess variant colors
--n-warning / --n-warning-lightWarning variant colors
--n-danger / --n-danger-lightDanger variant colors
--n-radiusAlert border radius
Table
Responsive, hover-enabled data tables.
Name Role Status Action
Alice Chen Engineer Active Edit
Bob Smith Designer Active Edit
Carol White PM Away Edit
David Park DevOps Offline Edit
API
CSS Custom Properties
Variable Role
--n-border-lightCell borders
--n-bg-altHeader background
--n-bg-hoverRow hover background
--n-radiusTable border radius
Progress
Slim progress bars with color variants.
API
CSS Custom Properties
Variable Role
--n-primaryDefault bar color
--n-successSuccess bar color
--n-dangerDanger bar color
--n-bg-hoverTrack background
--n-radius-fullBar border radius
Avatars
User representations with initials, images, and groups.
S
RC
LG
API
CSS Custom Properties
Variable Role
--n-primary-lightAvatar background (initials)
--n-primaryAvatar text color (initials)
--n-bgAvatar group border color
Kbd & Code
Keyboard shortcut indicators and inline code styling.
Press Ctrl + S to save. Use console.log() for debugging.
const greet = (name) => {
return `Hello, ${name}!`;
};
console.log(greet('Nought'));
API
CSS Custom Properties
Variable Role
--n-monoMonospace font family
--n-bg-altCode / kbd background
--n-border-lightKbd border color
--n-radius-smCode border radius
Skeleton
Animated loading placeholders.
API
CSS Custom Properties
Variable Role
--n-bg-hoverSkeleton base color
--n-bg-altShimmer highlight color
--n-radius-smSkeleton border radius
Breadcrumbs
Navigation trail for hierarchical pages.
API
HTML Attributes
Attribute Element Description
aria-label="Breadcrumb"<nav>Accessible navigation label
aria-current="page"Last <li> Marks the current page
CSS Custom Properties
Variable Role
--n-text-mutedSeparator and current-page color
--n-primaryLink color
Spinner
Loading indicators in multiple sizes.
API
HTML Attributes
Attribute Description
role="status"Announces loading state to screen readers
aria-label="Loading"Accessible label
CSS Custom Properties
Variable Role
--n-primarySpinner color
--n-borderSpinner track color
List
Structured list items with hover states.
A
Alice Chen
alice@example.com
Active
B
Bob Smith
bob@example.com
Away
C
Carol White
carol@example.com
Offline
API
CSS Custom Properties
Variable Role
--n-border-lightItem borders
--n-bg-hoverItem hover background
Tabs
Keyboard-navigable tabbed interface with ARIA roles.
Overview
Features
Pricing
Nought provides a complete set of production-ready components in under 8KB. Ship faster with semantic HTML.
25+ components, dark mode, ARIA-first accessibility, CSS custom properties for theming, and zero dependencies.
Free. Open source. MIT licensed. Forever.
<!-- Custom element: works in RSC, SSR, plain HTML -->
<n-tabs>
<div class="n-tabs" role="tablist">
<button class="n-tab active" role="tab"
aria-selected="true" aria-controls="panel-id">
Tab Label
</button>
</div>
<div id="panel-id" class="n-tab-panel active"
role="tabpanel">Content</div>
</n-tabs>
API
HTML Attributes
Attribute Element Description
role="tablist"Tab bar ARIA tablist role
role="tab"Tab button ARIA tab role
aria-selectedTab button Set to "true" on the active tab
aria-controlsTab button ID of the panel this tab controls
role="tabpanel"Panel ARIA tabpanel role
Keyboard
Key Action
ArrowRight Move to next tab
ArrowLeft Move to previous tab
CSS Custom Properties
Variable Role
--n-primaryActive tab indicator color
--n-text-secondaryInactive tab text color
--n-border-lightTab bar border
--n-transitionHover / active transition
Accordion
Collapsible content sections with smooth animations.
What is Nought?
A complete UI library in ~8KB. Two files — one CSS, one JS — that give you 25+ production-ready components with dark mode and full accessibility.
Do I need a build step?
No! Nought works with plain HTML files. Drop in the CSS and JS files, write semantic markup, and you're done. No webpack, no npm, no config.
Is it accessible?
Yes. Every component is built ARIA-first with proper roles, keyboard navigation, focus management, and screen reader support baked in.
<!-- Custom element: server-renders as-is -->
<n-accordion>
<div class="n-accordion-item">
<button class="n-accordion-trigger"
aria-expanded="false">Question?</button>
<div class="n-accordion-content">
<div class="n-accordion-content-inner">
Answer.
</div>
</div>
</div>
</n-accordion>
API
HTML Attributes
Attribute Element Description
multiple<n-accordion>Allow multiple items open at once
aria-expandedTrigger button Set to "true" to render an item open on load
CSS Custom Properties
Variable Role
--n-border-lightItem borders
--n-radiusContainer border radius
--n-bg-hoverTrigger hover background
--n-transitionExpand / collapse transition
Modal
Focus-trapping dialog with backdrop blur and keyboard dismissal.
Open Modal
<!-- Custom element: SSR/RSC compatible -->
<n-modal>
<div class="n-modal-overlay" aria-hidden="true">
<div class="n-modal" role="dialog">
<div class="n-modal-header">
<h3>Title</h3>
<button class="n-modal-close">×</button>
</div>
<div class="n-modal-body">Content</div>
</div>
</div>
</n-modal>
<!-- Open/close via JS: -->
<script>
document.querySelector('n-modal').open();
document.querySelector('n-modal').close();
</script>
API
JavaScript
Type Name Description
Method open()Opens the modal, moves focus to the close button
Method close()Closes the modal, restores focus to the trigger
Event openFired after the modal opens
Event closeFired after the modal closes
Attribute data-modalOn a trigger button — overlay ID to open
Attribute data-modal-closeOn a button — overlay ID to close
Keyboard
Key Action
Escape Close the modal
CSS Custom Properties
Variable Role
--n-surfaceModal background
--n-radius-lgModal border radius
--n-shadow-lgModal box shadow
--n-border-lightHeader / footer border
This modal uses the <n-modal> custom element. It works with React Server Components — the HTML renders on the server, the element enhances on the client.
Supports backdrop click to close, Esc key, and focus management — all built in.
Dropdown
Context menus with click-outside dismissal.
Options ▾
<!-- Custom element: auto-handles open/close -->
<n-dropdown class="n-dropdown">
<button aria-expanded="false"
aria-haspopup="true">Options ▾</button>
<div class="n-dropdown-menu" role="menu">
<button class="n-dropdown-item">Edit</button>
<button class="n-dropdown-item">Delete</button>
</div>
</n-dropdown>
API
HTML Attributes
Attribute Element Description
aria-haspopup="true"Trigger button Identifies the trigger (required)
aria-expandedTrigger button Toggled automatically by JS
role="menu"Menu ARIA menu role
role="menuitem"Menu item ARIA menuitem role
CSS Custom Properties
Variable Role
--n-surfaceMenu background
--n-shadow-lgMenu box shadow
--n-radiusMenu border radius
--n-bg-hoverItem hover background
--n-border-lightMenu border and divider color
Toast
Non-blocking notification messages via the JS API.
Success Toast
Error Toast
Warning Toast
Info Toast
<!-- Place once in your HTML -->
<n-toast-area></n-toast-area>
// Show via the element API:
document.querySelector('n-toast-area').show('Saved!', 'success');
// Or the global shortcut:
Nought.toast.show('Saved!', 'success');
Nought.toast.show('Error!', 'danger');
Nought.toast.show('Warning!', 'warning', 6000);
API
JavaScript
Type Name Description
Method show(message, type?, duration?)Show a toast. type: "success" | "danger" | "warning" | "info" (default). duration: ms, default 4000. Set 0 to persist.
Method Nought.toast.show()Global shortcut — auto-creates <n-toast-area> if not present
CSS Custom Properties
Variable Role
--n-surfaceToast background
--n-shadow-lgToast box shadow
--n-radiusToast border radius
--n-successSuccess border accent
--n-dangerDanger border accent
--n-warningWarning border accent
--n-infoInfo border accent
Drawer
Slide-out panel for secondary content or navigation.
Open Drawer
<!-- Custom element: SSR/RSC compatible -->
<n-drawer>
<div class="n-drawer-overlay"></div>
<aside class="n-drawer">
<div class="n-drawer-header">
<h3>Title</h3>
<button data-drawer-close>×</button>
</div>
<div class="n-drawer-body">Content</div>
</aside>
</n-drawer>
<!-- Open/close via JS: -->
<script>
document.querySelector('n-drawer').open();
document.querySelector('n-drawer').close();
</script>
API
JavaScript
Type Name Description
Method open()Opens the drawer
Method close()Closes the drawer, restores focus
Event openFired after the drawer opens
Event closeFired after the drawer closes
Attribute data-drawer-closeOn a button — closes the parent drawer
Keyboard
Key Action
Escape Close the drawer
CSS Custom Properties
Variable Role
--n-surfaceDrawer background
--n-shadow-lgDrawer box shadow
--n-border-lightHeader border
Dashboard
Projects
Team
Settings
Dark Mode
System-aware theming that respects prefers-color-scheme with manual override.
Click the sun icon in the navbar to toggle dark mode. Nought stores the preference in localStorage and auto-detects system theme.
<!-- Custom element: auto-detects system theme -->
<n-theme-toggle aria-label="Toggle dark mode">
🌓 Toggle Theme
</n-theme-toggle>
// Or customize theming via CSS custom properties:
:root {
--n-primary: #your-brand-color;
}
API
Custom Element
Tag Description
<n-theme-toggle>Click to toggle between light and dark mode. Auto-detects system preference on load.
HTML Attributes
Attribute Element Description
data-theme<html>Set to "dark" or "light". Toggled automatically.
aria-pressed<n-theme-toggle>Reflects current dark mode state
JavaScript
Type Name Description
Method Nought.darkMode.init()Apply stored or system theme (called automatically on load)
Storage
Key Values Description
n-theme"light" | "dark"Persisted in localStorage. Falls back to prefers-color-scheme.
Layout & Grid
Responsive grid system and flex utilities.
<div class="n-grid n-cols-3">
<div>Column 1</div>
<div>Column 2</div>
<div>Column 3</div>
</div>
<div class="n-container">
<div class="n-flex n-flex-between">...</div>
</div>
API
Utilities
Spacing, sizing, and helper classes.
Class Description
n-containerCentered container (max 72rem)
n-mt-{0-4}Margin top (0 / 0.5rem / 1rem / 1.5rem / 2rem)
n-mb-{0-3}Margin bottom
n-p-{0-4}Padding
n-flexFlexbox row with gap
n-grid n-cols-{2-4}CSS Grid with columns
n-text-sm / n-text-lgFont sizes
n-text-mutedMuted text color
n-sr-onlyScreen reader only (visually hidden)
n-hiddenDisplay none
n-rounded / n-rounded-fullBorder radius variants
n-w-fullWidth 100%