Quick Start
Connect the library to your project in under a minute β no build tools required.
<link> tag in <head>. Nothing else
required.data-theme to the <html> element. All
components adapt automatically.</body>.details/summary (native collapse, native dropdown) work without JS. See
the JavaScript reference for all functions.
Themes
9 built-in themes, each defined as a complete set of CSS custom properties. Switch the entire UI with one attribute β no JavaScript required.
.btn-primary Β· .btn-outline
.btn-ghost Β· .btn-gradient
.btn-glow Β· .btn-shine
.btn-sm Β· .btn-lg
.card-dark Β· .card-bordered
.card-glow Β· .box
.inp-glass Β· .float-field
.toggle Β· .check
.inp-select
.tab-btn Β· .tab-panel
.tab-nav-pills
.tab-nav-boxed Β· .tab-nav-card
.tab-nav.is-full Β· .tab-badge
.collapse + JS toggle
.collapse-plus Β· .collapse-ghost
.collapse-primary
.accordion Β· .accordion-flush
.lib-modal-box
.is-success Β· .is-error
.is-warning Β· .is-info
.lib-modal-close
.nav-solid Β· .nav-glass
.nav-primary Β· .nav-dark
.nav-floating Β· .nav-underline
.nav-sm Β· .nav-lg
.dropdown + JS toggle
.dropdown-menu Β· .dropdown-item
.dropdown-right Β· .dropdown-top
.dropdown-primary Β· .dropdown-dark
.carousel-center Β· .carousel-gap
.carousel-vertical
.carousel-btn Β· .carousel-dots
.carousel-item-sm/md/lg/xl
.link-slide Β· .link-arrow
.link-external Β· .link-muted
.link-btn Β· .link-card
.link-list
.tag-primary Β· .tag-success
.tag-accent Β· .tag-outline
.progress Β· .progress-bar
.lib-toast Β· .lib-toast-success
.lib-toast-error Β· .lib-toast-primary
.text-gradient-primary
.gradient-blue-purple
.hover-brighten Β· .hover-rotate
njx.js for interactivity.
Components marked native use <details>/<summary> and
work without any JavaScript.JavaScript β njx.js
One script file for all interactive components. Include it once β everything initializes automatically.
Connection
Which components need JS
| Component | Without JS | With njx.js |
|---|---|---|
| Collapse | details.collapse β ΡΠ°Π±ΠΎΡΠ°Π΅Ρ Π½Π°ΡΠΈΠ²Π½ΠΎ |
collapseToggle() Π΄Π»Ρ div-based +
Π°ΠΊΠΊΠΎΡΠ΄Π΅ΠΎΠ½ |
| Dropdown | details.dropdown β ΡΠ°Π±ΠΎΡΠ°Π΅Ρ Π½Π°ΡΠΈΠ²Π½ΠΎ |
dropdownToggle() Π΄Π»Ρ div-based + close
on outside click |
| Tabs | β | tabSwitch() β ΠΏΠ΅ΡΠ΅ΠΊΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΠΏΠ°Π½Π΅Π»Π΅ΠΉ |
| Modal | β | openModal() / closeModal()
+ Escape |
| Carousel | Scroll-snap ΡΠ°Π±ΠΎΡΠ°Π΅Ρ, ΡΠΊΠΎΡΠ½ΡΠ΅ ΠΊΠ½ΠΎΠΏΠΊΠΈ ΡΠ°Π±ΠΎΡΠ°ΡΡ | initCarousels() β ΡΠΈΠ½Ρ
ΡΠΎΠ½ΠΈΠ·Π°ΡΠΈΡ dots ΠΏΡΠΈ
ΡΠ²Π°ΠΉΠΏΠ΅ |
| Toast | β | showToast() β Π΄ΠΈΠ½Π°ΠΌΠΈΡΠ΅ΡΠΊΠΈΠ΅ ΡΠ²Π΅Π΄ΠΎΠΌΠ»Π΅Π½ΠΈΡ
|
| Buttons, Cards, Forms, Nav, Links, Tags, Table, Progress, Gradients, Animations | β Π§ΠΈΡΡΡΠΉ CSS β JS Π½Π΅ Π½ΡΠΆΠ΅Π½ | |
Function reference
collapseToggle(header)
collapse
Toggles .is-open on the
closest .collapse element.
accordionToggle(header)
accordion
Like collapseToggle but
closes all sibling .collapse items in the same .accordion wrapper first.
dropdownToggle(el)
dropdown
Toggles .is-open on a
.dropdown element. All other open dropdowns are closed first. Outside-click listener is added
automatically.
tabSwitch(btn)
tabs
Activates the clicked
.tab-btn and shows the corresponding .tab-panel by index inside
.tab-wrap.
openModal(id) / closeModal(el)
modal
Opens a modal by its ID / closes by element reference. Escape key auto-closes all open modals. Click on overlay background also closes.
showToast(msg, type, duration)
toast
Shows a toast notification. Types:
success Β· error Β· primary Β· dark. Duration in ms
(default 2200). Requires <div id="lib-toast-container"></div> in the
page.
initCarousels() / carouselGo(el, idx)
carousel
initCarousels() is called
automatically on DOMContentLoaded β it attaches a scroll listener to every
.carousel-wrap and syncs .carousel-dot.is-active. carouselGo(el, idx)
programmatically scrolls to a slide by 0-based index.
<details class="collapse"> and <details class="dropdown"> β the
browser handles open/close natively, zero JS needed.
Design Tokens
All values are CSS custom properties defined in _base.css. Use them in
your own styles for automatic theme adaptation.
| Token | Description |
|---|---|
| --color-primary | Main brand color (theme-reactive) |
| --color-accent | Secondary accent |
| --color-success | Green / success state |
| --color-error | Red / error state |
| --color-warning | Orange / warning state |
| --text-main | Primary text |
| --text-muted | Secondary / muted text |
| --bg-main | Page background |
| --bg-secondary | Card / surface background |
| Token | Value |
|---|---|
| --space-1 | 4px |
| --space-2 | 8px |
| --space-3 | 12px |
| --space-4 | 16px |
| --space-6 | 24px |
| --space-8 | 32px |
| --space-12 | 48px |
| --space-16 | 64px |
| Token | Value |
|---|---|
| --fs-xs | 12px |
| --fs-sm | 14px |
| --fs-base | 16px |
| --fs-lg | 18px |
| --fs-xl | 20px |
| --fs-2xl | 24px |
| --fs-3xl | 30px |
| --fs-4xl | 36px |
| --fs-5xl | 48px |
| --radius-none | 0 |
| --radius-sm | 6px |
| --radius-md | 12px |
| --radius-lg | 20px |
| --radius-full | 9999px |
| --ease-fast | 0.1s ease |
| --ease | 0.2s ease |
| --ease-slow | 0.4s ease |
Using Design Tokens
How to write CSS that works with all 9 themes automatically.
Colors β --color-*
Never hardcode a hex value. Use a token β and when the theme changes, the color updates automatically everywhere.
Spacing β --space-*
4px base grid. Index = multiplier Γ 4px.
4px
8px
12px
16px
24px
32px
48px
64px
Typography β --fs-*
12px
14px
16px
18px
20px
24px
30px
36px
48px
Radius & Shadows β --radius-* /
--shadow-*
0
6px
12px
20px
9999px
Transitions β --ease-*
Full component β tokens only
Utility Classes
Tailwind-compatible utility classes for fast layout. All in _utils.css.
Animations
Built-in CSS animations from _animations.css. Just add a class β no
JavaScript.
.fade-out
.scale-up
.slide-down
.bounce-in
.pulse-slow
.glow-hover
.spin-slow
.shake-error
.animate-neon-blue
.animate-breathe
.anim-fast Β· .anim-slow
File Structure
All CSS is modular β import everything via style.css or pick individual
files.
_base.css + _themes.css + _buttons.css
+ _cards.css and save several KB.Examples
Common patterns β copy and adapt.