nyx-css
v1.0.3
Published
A zero-dependency CSS & JS component framework with Luminous Depth — light & dark themes, fully themeable via CSS variables, with first-class RTL and Arabic typography.
Maintainers
Readme
The dark‑native design system with Luminous Depth
Every interactive element feels lit from within. A zero‑dependency CSS + JS component framework — fully themeable, light & dark, with first‑class RTL and Arabic typography.
npm i nyx-css · Documentation · Components · Theming · العربية
Think Bootstrap — but dark by default, opinionated for the SaaS era, and bilingual. One signature trait sets it apart: Luminous Depth. Glow, glass, and gradient are baked into the tokens, so every surface reads as if backlit.
✦ Why Nyx
- 🌑 Dark‑native, light‑ready — both themes ship built‑in; flip with one attribute.
- 🎨 Themeable to the core — every value is a
--nyx-*custom property. Retint the whole system withcolor-mix(); no recompile. - 🌍 RTL & Arabic, first‑class — logical properties throughout, a dedicated RTL layer, Arabic faces by default (IBM Plex Sans Arabic + Aref Ruqaa), and the self‑hosted Thmanyah family bundled in
fonts/. - 🧩 100+ components — buttons to command palettes, charts, timelines, carousels, data grids, MENA/Arabic regional widgets, and signature pieces you won't find elsewhere.
- ⚡ Tiny vanilla runtime — UMD
window.Nyx, declarativedata-nyx-*, auto‑inits on load. Most pages need no JS at all. - 📦 À‑la‑carte or all‑in‑one — ship the full bundle or just the modules you import. Zero dependencies (except Google Fonts).
⚡ Quick start
npm i nyx-css…or drop two files into any page — no build step:
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<!-- fonts (the only external dependency) -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap" rel="stylesheet">
<!-- 1 · the framework -->
<link rel="stylesheet" href="nyx.css">
</head>
<body class="nyx nyx-reset">
<button class="nyx-btn nyx-btn-primary">Hello, Nyx</button>
<!-- 2 · the runtime (tabs, modals, toasts, scrollspy…) -->
<script src="nyx.js"></script>
</body>
</html>From a CDN (no install — @1 tracks the latest 1.x):
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nyx-css@1/nyx.min.css">
<script src="https://cdn.jsdelivr.net/npm/nyx-css@1/nyx.min.js"></script>Two body classes: nyx (canvas, base type, focus rings, scrollbars — required) and nyx-reset (opt‑in box-sizing: border-box + reset — recommended).
🎨 Theming
Override any token, anywhere downstream — that's the whole API.
:root {
--nyx-accent: #ff5d8f; /* swap the violet for pink */
--nyx-accent-2: #29e0c4; /* secondary / success accent */
--nyx-radius: 12px; /* round everything a bit more */
}Tokens cover color, the type scale (--nyx-fs-xs … --nyx-fs-3xl), spacing (--nyx-s1 … --nyx-s9, 4px base), radii, shadows, and the signature --nyx-glow. Prebuilt accent themes ship in the box: violet · emerald · rose · amber.
Light & dark · RTL
<html data-theme="light"> <!-- default is "dark" -->
<html dir="rtl"> <!-- every component mirrors -->Nyx.toggleTheme(); // flips + persists to localStorage
Nyx.toggleDir(); // RTL ⇄ LTR🧠 JavaScript
nyx.js is UMD (attaches global Nyx, supports require) and auto‑initializes on DOMContentLoaded.
Declarative — most behaviors need no script:
<button data-nyx-toggle="modal" data-nyx-target="#myModal">Open modal</button>
<button data-nyx-toggle="drawer" data-nyx-target="#myDrawer">Open drawer</button>
<button data-nyx-toggle="command">Search (⌘K)</button>
<nav class="nyx-sidebar" data-nyx-spy>…</nav> <!-- scrollspy -->
<table class="nyx-table nyx-table-sortable">…</table> <!-- click to sort -->Imperative:
| Method | Description |
| --- | --- |
| Nyx.toast(message, type, ms) | Toast. type: info | success | warning | danger. |
| Nyx.openModal(target) / openDrawer(target) | Open an overlay ('#id' or element). |
| Nyx.close(target) / closeAll() | Close one / all overlays. |
| Nyx.openCommandPalette() | Open the ⌘K palette. |
| Nyx.init(root) | Re‑wire data-nyx-* after injecting markup. Idempotent. |
Nyx.toast('Saved ✓', 'success');
Nyx.openModal('#invite');Keyboard: ⌘K / Ctrl+K opens the command palette; Esc closes any overlay.
🧩 Components
Layout
nyx-gridnyx-col-*nyx-flexnyx-stacknyx-containernyx-dividerTypographynyx-displaynyx-h1–nyx-h6nyx-leadnyx-gradient-textnyx-codeButtonsnyx-btn+-primary-secondary-ghost-danger-glass-glow-icon-outline-*· sizes-sm-lg·-loading·nyx-btn-groupCardsnyx-card+-glass-gradient-interactive-stat-featureFormsnyx-inputnyx-textareanyx-selectnyx-input-groupnyx-searchnyx-togglenyx-checkboxnyx-radionyx-rangenyx-floatNavigationnyx-navbarnyx-sidebarnyx-breadcrumbnyx-tabsnyx-nav-pillsnyx-paginationnyx-dropdownnyx-command-paletteFeedbacknyx-badgenyx-alertnyx-toastnyx-progressnyx-skeletonnyx-spinnernyx-status-barDatanyx-tablenyx-table-sortablenyx-data-gridnyx-kpi-rownyx-list-groupOverlaysnyx-modalnyx-drawernyx-tooltipnyx-popovernyx-accordionnyx-collapsenyx-carouselnyx-ratioSignaturenyx-spotlightnyx-orbitnyx-chipnyx-timelinenyx-meternyx-gradient-bordernyx-avatarnyx-marqueenyx-segmentnyx-ratingnyx-emptynyx-bannernyx-dropzoneChartsnyx-chart-barsnyx-chart-linenyx-chart-donutnyx-chart-pienyx-chart-legend— zero‑dep CSS + SVG, accent‑driven Backgroundsnyx-bg-gridnyx-bg-dotsnyx-bg-meshnyx-bg-gradientnyx-bg-beamsnyx-bg-noisenyx-bg-starsnyx-bg-squaresMotionnyx-anim-fadenyx-anim-up/-left/-rightnyx-anim-blurnyx-anim-floatnyx-anim-pulse-glow· scroll‑reveal + delays Codenyx-code-block— titled window, syntax tokens, one‑tap copy viadata-nyx-copyCommercenyx-productnyx-cart-itemnyx-couponnyx-paynyx-ordernyx-pricenyx-addressRegional · MENAnyx-countdownnyx-prayer-timesnyx-qiblanyx-zakatnyx-hijri-convertnyx-deliverynyx-bnplnyx-invoice(ZATCA QR)nyx-national-address
Every component has its own page — with live examples, a class reference, and a search‑filterable sidebar — in docs.html (and docs.ar.html in Arabic).
📁 Project layout
| Path | Purpose |
| --- | --- |
| nyx.css / nyx.min.css | The framework — design tokens + every component (full + minified). |
| nyx.js / nyx.min.js | The runtime — declarative data-nyx-* + the imperative Nyx.* API. |
| components/*.css | À‑la‑carte modules generated by build.js (each needs tokens.css). |
| build.js | Splits nyx.css into components/ + nyx.bundle.css, and minifies. |
| index.html · index.ar.html | Marketing landing page (English / Arabic RTL). |
| docs.html · docs.ar.html · docs.js | Documentation SPA — a hash router renders one component per route from the registry. |
Adding a doc page needs no new HTML — just push an object to the PAGES array in docs.js:
{
id: 'tooltips', group: 'Components', title: 'Tooltips',
summary: 'CSS-only hover tooltips on four sides.',
sections: [{ title: 'Four sides', demo: '<span class="nyx-tooltip">…</span>' }],
classes: [['nyx-tooltip', 'Hover target wrapper.']]
}Each section's demo renders both as the live example and as its (escaped, highlighted) code snippet — so they never drift.
🌐 Browser support
Modern evergreen browsers (Chrome · Edge · Firefox · Safari). Uses CSS custom properties, grid, backdrop-filter, and IntersectionObserver. Respects prefers-reduced-motion.
📜 License
MIT © Nyx. The self‑hosted Thmanyah Arabic typeface (fonts/thmanyah/) is © ثمانية (Thmanyah) and remains under its own license.
