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.