@adminlte/react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +161 -0
- package/README.md +454 -0
- package/dist/context/accessibility.js +141 -0
- package/dist/context/body-class-sync.js +22 -0
- package/dist/context/color-mode-context.js +61 -0
- package/dist/context/command-palette-context.js +28 -0
- package/dist/context/html-dir.js +17 -0
- package/dist/context/link-context.js +18 -0
- package/dist/context/lte-behaviors.js +52 -0
- package/dist/context/sidebar-context.js +87 -0
- package/dist/css/adminlte.css +17259 -0
- package/dist/form/button.js +21 -0
- package/dist/form/input-color.js +30 -0
- package/dist/form/input-file.js +29 -0
- package/dist/form/input-flatpickr.js +45 -0
- package/dist/form/input-switch.js +26 -0
- package/dist/form/input-tom-select.js +59 -0
- package/dist/form/input.js +23 -0
- package/dist/form/select.js +25 -0
- package/dist/form/textarea.js +22 -0
- package/dist/hooks/use-card-widget.js +44 -0
- package/dist/hooks/use-direct-chat.js +16 -0
- package/dist/hooks/use-fullscreen.js +44 -0
- package/dist/hooks/use-push-menu.js +54 -0
- package/dist/hooks/use-sortable.js +26 -0
- package/dist/hooks/use-treeview-animation.js +27 -0
- package/dist/index.d.ts +1010 -0
- package/dist/index.js +145 -0
- package/dist/layout/app-content.js +18 -0
- package/dist/layout/auth-layout.js +25 -0
- package/dist/layout/color-mode-toggle.js +67 -0
- package/dist/layout/dashboard-layout.js +101 -0
- package/dist/layout/footer.js +19 -0
- package/dist/layout/sidebar-brand.js +16 -0
- package/dist/layout/sidebar-nav-item.js +46 -0
- package/dist/layout/sidebar-nav.js +43 -0
- package/dist/layout/sidebar-overlay.js +18 -0
- package/dist/layout/sidebar.js +48 -0
- package/dist/layout/topbar.js +128 -0
- package/dist/lib/class-name.js +6 -0
- package/dist/lib/flatten-menu.js +23 -0
- package/dist/tool/datatable.js +45 -0
- package/dist/tool/editor.js +72 -0
- package/dist/tool/modal.js +28 -0
- package/dist/types/direct-chat.js +0 -0
- package/dist/types/layout.js +0 -0
- package/dist/types/menu.js +0 -0
- package/dist/types/theme.js +0 -0
- package/dist/widget/accordion.js +35 -0
- package/dist/widget/alert.js +18 -0
- package/dist/widget/apex-chart.js +40 -0
- package/dist/widget/avatar.js +72 -0
- package/dist/widget/badge.js +20 -0
- package/dist/widget/breadcrumb.js +26 -0
- package/dist/widget/callout.js +11 -0
- package/dist/widget/card.js +84 -0
- package/dist/widget/carousel.js +56 -0
- package/dist/widget/command-palette.js +137 -0
- package/dist/widget/description-block.js +19 -0
- package/dist/widget/direct-chat.js +96 -0
- package/dist/widget/dropdown.js +63 -0
- package/dist/widget/info-box.js +24 -0
- package/dist/widget/list-group.js +47 -0
- package/dist/widget/nav-messages.js +48 -0
- package/dist/widget/nav-notifications.js +40 -0
- package/dist/widget/nav-tasks.js +60 -0
- package/dist/widget/offcanvas.js +61 -0
- package/dist/widget/pagination.js +93 -0
- package/dist/widget/profile-card.js +32 -0
- package/dist/widget/progress-group.js +23 -0
- package/dist/widget/progress.js +25 -0
- package/dist/widget/ratings.js +20 -0
- package/dist/widget/small-box.js +34 -0
- package/dist/widget/sparkline-chart.js +43 -0
- package/dist/widget/spinner.js +26 -0
- package/dist/widget/stepper.js +57 -0
- package/dist/widget/table.js +50 -0
- package/dist/widget/tabs.js +46 -0
- package/dist/widget/timeline.js +15 -0
- package/dist/widget/toast.js +41 -0
- package/dist/widget/tooltip.js +30 -0
- package/dist/widget/world-map.js +42 -0
- package/package.json +116 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **adminlte-react** are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### UI element components
|
|
13
|
+
|
|
14
|
+
- `Badge` — contrast-aware `text-bg-*` label; `pill` and `positioned` (overlay) variants.
|
|
15
|
+
- `Breadcrumb` — data-driven trail; last item renders as the active page; optional `divider`.
|
|
16
|
+
- `Pagination` — controlled, windowed with ellipses; renders `<button>`s when given
|
|
17
|
+
`onPageChange`, otherwise `<a>`; `size`, `siblingCount`, and `align` options.
|
|
18
|
+
- `Spinner` — `border`/`grow` variants with an accessible status label.
|
|
19
|
+
- `Avatar` / `AvatarGroup` — image or initials fallback, presence dot, overlapping stacks.
|
|
20
|
+
- `ListGroup` / `ListGroupItem` — item renders as `<a>`, `<button>`, or `<div>` based on its
|
|
21
|
+
props (`href`/`onClick`/`action`); `active`, `disabled`, contextual `theme`.
|
|
22
|
+
- `Table` — generic, column-driven table (`columns` + `data`, custom cell `render`, `rowKey`)
|
|
23
|
+
with `striped`/`hover`/`bordered`/`small`/`responsive` options.
|
|
24
|
+
- `Dropdown` — items, dividers, headers, icons; `split`, `direction`, `align`, outline variant
|
|
25
|
+
(driven by the Bootstrap JS bundle).
|
|
26
|
+
- `Carousel` — slides with captions, indicators, controls, fade, autoplay (Bootstrap JS bundle).
|
|
27
|
+
- `Offcanvas` / `OffcanvasTrigger` — slide-in panel with header/footer and a paired trigger
|
|
28
|
+
(Bootstrap JS bundle).
|
|
29
|
+
- `Stepper` — controlled progress/wizard stepper (horizontal or vertical, optional clickable steps).
|
|
30
|
+
|
|
31
|
+
#### Navigation
|
|
32
|
+
|
|
33
|
+
- `LinkProvider` / `useLinkComponent` and a `linkComponent` prop on `DashboardLayout` — inject a
|
|
34
|
+
router link (e.g. an adapter around `next/link`) so sidebar navigation is client-side. Defaults
|
|
35
|
+
to a plain `<a>`, keeping the library framework-agnostic.
|
|
36
|
+
- `docsHref` / `docsLabel` props on `DashboardLayout` for the sidebar footer link, routed through
|
|
37
|
+
the injectable Link. **Changed:** the footer link is now opt-in — previously it was hardcoded to
|
|
38
|
+
the external AdminLTE HTML docs; it now renders only when `docsHref` is set (point it at your own
|
|
39
|
+
docs). The demo points it at its in-app `/docs`.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **Build: per-file ESM output (RSC boundaries preserved).** The package is no longer a single
|
|
44
|
+
bundled file stamped with a blanket `"use client"`. Each source module now compiles to its own
|
|
45
|
+
`dist/` file, so the `'use client'` directive survives per component: server-component-authored
|
|
46
|
+
widgets (`Button`, `Input`, `SmallBox`, `DashboardLayout`, …) stay Server Components for
|
|
47
|
+
consumers, and bundlers can tree-shake through the barrel. CommonJS output was dropped (the
|
|
48
|
+
package is ESM-only; it targets Next.js 14+ / modern bundlers). Sourcemaps are no longer
|
|
49
|
+
published (≈7 MB lighter tarball; dist shrank from ≈9 MB to ≈0.75 MB).
|
|
50
|
+
- **All heavy plugins are now optional peer dependencies** (`apexcharts`, `flatpickr`,
|
|
51
|
+
`jsvectormap`, `quill`, `sortablejs`, `tabulator-tables`, `tom-select`). Previously apexcharts,
|
|
52
|
+
jsvectormap, and sortablejs were silently bundled in; now all plugins follow the documented
|
|
53
|
+
model — install only the ones whose components you use. They are still lazy-loaded via dynamic
|
|
54
|
+
`import()`, which Next.js code-splits per page.
|
|
55
|
+
- `flattenMenuToCommands` / `CommandItem` moved to a server-safe module so Server Components
|
|
56
|
+
(e.g. `DashboardLayout`) can flatten menus during server render. Barrel imports are unchanged.
|
|
57
|
+
- `ApexChart` props are now typed (`config: ApexOptions`, typed `series`) instead of `any`, and
|
|
58
|
+
prop changes update the chart in place (`updateOptions`) instead of destroy + re-create.
|
|
59
|
+
Inline (non-memoized) `series`/`config` objects no longer re-create the chart every render.
|
|
60
|
+
- `SidebarProvider` / `ColorModeProvider` context values are memoized — consumers no longer
|
|
61
|
+
re-render on every provider render.
|
|
62
|
+
- `Input`, `Select`, `Textarea`, and `InputSwitch` forward refs to their underlying form
|
|
63
|
+
controls (focus management, react-hook-form, etc.).
|
|
64
|
+
- Sidebar OverlayScrollbars detection switched from a 100 ms `setInterval` poll to an immediate
|
|
65
|
+
check + `requestAnimationFrame` retry loop, tolerating lazily loaded
|
|
66
|
+
(`next/script afterInteractive`) OverlayScrollbars.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- `Datatable` destroys its Tabulator instance on unmount/re-render (previously leaked instances
|
|
71
|
+
and stacked tables on prop changes).
|
|
72
|
+
- `Editor` no longer creates a second Quill instance when `placeholder`/`quillOptions` change;
|
|
73
|
+
the `value` prop now syncs into the editor after mount (controlled usage works), and the
|
|
74
|
+
hidden form input tracks the edited HTML instead of the stale `value` prop.
|
|
75
|
+
- `Card` `removable` tool button actually removes the card (was a no-op); new `onRemove`
|
|
76
|
+
callback fires after removal.
|
|
77
|
+
- `Input` `igroupSize` now actually sizes the control (`form-control-sm`/`form-control-lg`);
|
|
78
|
+
previously the computed class was never applied.
|
|
79
|
+
|
|
80
|
+
### Tested
|
|
81
|
+
|
|
82
|
+
- Vitest unit tests for pure logic and presentational components.
|
|
83
|
+
- CI workflow (GitHub Actions): type-check, lint, unit tests, library build, an RSC-boundary
|
|
84
|
+
check on `dist/`, and demo type-check + build.
|
|
85
|
+
|
|
86
|
+
## [0.1.0] - 2026-05-29
|
|
87
|
+
|
|
88
|
+
Initial public release — an AdminLTE 4 / Bootstrap 5.3 component library for the
|
|
89
|
+
Next.js App Router and React Server Components.
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
|
|
93
|
+
#### Layout
|
|
94
|
+
|
|
95
|
+
- `DashboardLayout` — the application shell. A React Server Component that computes
|
|
96
|
+
static `<body>` layout classes on the server and nests the client providers
|
|
97
|
+
(color mode, sidebar, command palette) inside. Supports `fixedHeader`,
|
|
98
|
+
`fixedSidebar`, `fixedFooter`, `sidebarMini`, `sidebarTheme`, `sidebarBreakpoint`,
|
|
99
|
+
RTL via `dir`, optional sidebar-state persistence, and custom topbar/footer slots.
|
|
100
|
+
- `AuthLayout` — standalone login/register layout that applies its body classes via
|
|
101
|
+
effect, so it composes under a Next.js root layout.
|
|
102
|
+
- `AppContent` — page content wrapper with title and breadcrumbs.
|
|
103
|
+
- Lower-level pieces exported for custom shells: `Topbar`, `Sidebar`, `SidebarBrand`,
|
|
104
|
+
`SidebarNav`, `SidebarNavItem`, `SidebarOverlay`, `Footer`, `ColorModeToggle`.
|
|
105
|
+
|
|
106
|
+
#### Widgets
|
|
107
|
+
|
|
108
|
+
- `SmallBox`, `InfoBox`, `Card` (collapse / maximize / remove), `Alert`, `Callout`,
|
|
109
|
+
`Progress`, `ProgressGroup`, `Ratings`, `ProfileCard`, `DescriptionBlock`,
|
|
110
|
+
`Timeline`.
|
|
111
|
+
- Topbar dropdowns: `NavMessages`, `NavNotifications`, `NavTasks`.
|
|
112
|
+
- `DirectChat` — chat card with a slide-in contacts pane.
|
|
113
|
+
- `ApexChart` and `SparklineChart` — ApexCharts wrappers (lazy-loaded).
|
|
114
|
+
- `WorldMap` — jsVectorMap world map (lazy-loaded).
|
|
115
|
+
- `CommandPalette` — ⌘K / Ctrl+K searchable navigator, plus the
|
|
116
|
+
`flattenMenuToCommands` helper to build commands from a menu tree.
|
|
117
|
+
|
|
118
|
+
#### Forms
|
|
119
|
+
|
|
120
|
+
- `Button`, `Input`, `Select`, `Textarea`, `InputSwitch`, `InputColor`, `InputFile`.
|
|
121
|
+
- `InputFlatpickr` (date/time picker) and `InputTomSelect` (searchable / multi-select),
|
|
122
|
+
both lazy-loaded.
|
|
123
|
+
|
|
124
|
+
#### Tools
|
|
125
|
+
|
|
126
|
+
- `Modal` — Bootstrap modal dialog.
|
|
127
|
+
- `Datatable` — Tabulator-powered data grid with local data or remote `apiUrl`
|
|
128
|
+
(lazy-loaded).
|
|
129
|
+
- `Editor` — Quill rich-text editor (lazy-loaded).
|
|
130
|
+
|
|
131
|
+
#### Contexts & hooks
|
|
132
|
+
|
|
133
|
+
- Contexts: `SidebarProvider` / `useSidebarContext`,
|
|
134
|
+
`ColorModeProvider` / `useColorModeContext`,
|
|
135
|
+
`CommandPaletteProvider` / `useCommandPalette`.
|
|
136
|
+
- Hooks: `usePushMenu`, `useCardWidget`, `useDirectChat`, `useFullscreen`,
|
|
137
|
+
`useTreeviewAnimation`, `useSortable`.
|
|
138
|
+
|
|
139
|
+
#### Theming
|
|
140
|
+
|
|
141
|
+
- Light / dark / auto color modes driven by Bootstrap's `data-bs-theme`, with
|
|
142
|
+
`auto` resolved from `prefers-color-scheme` and the choice persisted to
|
|
143
|
+
`localStorage` (`lte-theme`).
|
|
144
|
+
- Optional sidebar collapsed-state persistence (`lte.sidebar.state`).
|
|
145
|
+
|
|
146
|
+
#### Types
|
|
147
|
+
|
|
148
|
+
- Fully typed public API, including `MenuNode` (`header` | `item` | `group`),
|
|
149
|
+
`BootstrapTheme`, `ColorMode`, `DashboardLayoutProps`, `AuthLayoutProps`,
|
|
150
|
+
`AppContentProps`, `TopbarUser`, direct-chat types, and `CommandItem`.
|
|
151
|
+
|
|
152
|
+
### Notes
|
|
153
|
+
|
|
154
|
+
- Built with `tsup` to dual ESM + CJS with type declarations and source maps. The
|
|
155
|
+
published bundle is tagged `"use client"` so it works under the App Router; the
|
|
156
|
+
AdminLTE stylesheet ships under the `adminlte-react/css` export.
|
|
157
|
+
- Heavy third-party libraries are never bundled eagerly — they load via dynamic
|
|
158
|
+
`import()` inside the components that use them.
|
|
159
|
+
|
|
160
|
+
[Unreleased]: https://github.com/ColorlibHQ/adminlte-react/compare/v0.1.0...HEAD
|
|
161
|
+
[0.1.0]: https://github.com/ColorlibHQ/adminlte-react/releases/tag/v0.1.0
|
package/README.md
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
# AdminLTE React
|
|
2
|
+
|
|
3
|
+
[](#license)
|
|
4
|
+
[](https://react.dev)
|
|
5
|
+
[](https://nextjs.org)
|
|
6
|
+
[](https://getbootstrap.com/docs/5.3/)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](#performance)
|
|
9
|
+
|
|
10
|
+
A modern React/Next.js component library for building admin dashboards and web applications with AdminLTE 4 styling and Bootstrap 5.3 — built for the Next.js App Router and React Server Components by [Colorlib](https://colorlib.com).
|
|
11
|
+
|
|
12
|
+
**Status**: v0.1.0 (Early Release) · **Live demo:** [adminlte.io/themes/next-react](https://adminlte.io/themes/next-react/)
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://adminlte.io/themes/next-react/">
|
|
16
|
+
<img alt="AdminLTE React dashboard — light theme" src="docs/screenshots/dashboard-light.png" width="49%">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://adminlte.io/themes/next-react/">
|
|
19
|
+
<img alt="AdminLTE React dashboard — dark theme" src="docs/screenshots/dashboard-dark.png" width="49%">
|
|
20
|
+
</a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
**Available for your stack** — the same AdminLTE 4 dashboard, in the framework you know best:
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="https://github.com/ColorlibHQ/adminlte-react"><img height="36" alt="React" src="https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB"></a>
|
|
27
|
+
<a href="https://github.com/ColorlibHQ/adminlte-react"><img height="36" alt="Next.js" src="https://img.shields.io/badge/Next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white"></a>
|
|
28
|
+
<a href="https://github.com/ColorlibHQ/adminlte-vue"><img height="36" alt="Vue" src="https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D"></a>
|
|
29
|
+
<a href="https://github.com/ColorlibHQ/adminlte-vue"><img height="36" alt="Nuxt" src="https://img.shields.io/badge/Nuxt-00DC82?style=for-the-badge&logo=nuxt&logoColor=white"></a>
|
|
30
|
+
<a href="https://github.com/ColorlibHQ/adminlte-laravel"><img height="36" alt="Laravel" src="https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white"></a>
|
|
31
|
+
<a href="https://github.com/ColorlibHQ/adminlte-django"><img height="36" alt="Django" src="https://img.shields.io/badge/Django-092E20?style=for-the-badge&logo=django&logoColor=white"></a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<p align="center"><sub>
|
|
35
|
+
Frameworks:
|
|
36
|
+
<a href="https://github.com/ColorlibHQ/adminlte-react">React</a> ·
|
|
37
|
+
<a href="https://github.com/ColorlibHQ/adminlte-react">Next.js</a> ·
|
|
38
|
+
<a href="https://github.com/ColorlibHQ/adminlte-vue">Vue</a> ·
|
|
39
|
+
<a href="https://github.com/ColorlibHQ/adminlte-vue">Nuxt</a> ·
|
|
40
|
+
<a href="https://github.com/ColorlibHQ/adminlte-laravel">Laravel</a> ·
|
|
41
|
+
<a href="https://github.com/ColorlibHQ/adminlte-django">Django</a>
|
|
42
|
+
</sub></p>
|
|
43
|
+
|
|
44
|
+
> **Documentation:** Full guides and an API reference for every component, hook, and
|
|
45
|
+
> context live in the demo app under `/docs`. Run `pnpm demo` and open
|
|
46
|
+
> [`/docs/introduction`](http://localhost:3000/docs/introduction). A condensed reference
|
|
47
|
+
> follows below, and the release history is in the [CHANGELOG](./CHANGELOG.md).
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
- ✨ **React Server Components (RSC)** - Server-first; only interactive parts ship as client components
|
|
52
|
+
- 📦 **No required runtime dependencies** - Beyond the React/Next peers; nothing extra forced into your bundle
|
|
53
|
+
- 🎨 **Pre-built Components** - 30+ components across layout, widgets, forms, and tools
|
|
54
|
+
- 🌙 **Dark Mode Support** - Light/Dark/Auto, driven by Bootstrap's `data-bs-theme`
|
|
55
|
+
- ♿ **Accessible** - Semantic markup, ARIA landmarks, keyboard navigation
|
|
56
|
+
- 🎯 **TypeScript First** - Fully typed props, hooks, and the menu data model
|
|
57
|
+
- 📱 **Responsive** - Mobile-first Bootstrap 5.3 design with an off-canvas sidebar
|
|
58
|
+
- 🔌 **Lazy plugins** - ApexCharts, Tabulator, Quill, Flatpickr, Tom Select & jsVectorMap load on demand
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install adminlte-react
|
|
64
|
+
# or
|
|
65
|
+
pnpm add adminlte-react
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Peer Dependencies
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install react react-dom next
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`react` and `react-dom` (18+) are required. **Next.js 14+** is required in practice — the
|
|
75
|
+
sidebar uses `next/navigation` for active-link detection and the command palette uses the
|
|
76
|
+
Next router. You also need **Bootstrap 5.3 JavaScript** (for dropdowns, modals, tooltips,
|
|
77
|
+
toasts) and **Bootstrap Icons** (the components use `bi-*` classes); load both from a CDN
|
|
78
|
+
or install them:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install bootstrap bootstrap-icons
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Optional Plugins
|
|
85
|
+
|
|
86
|
+
Install only the libraries for the lazy components you use:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install apexcharts # <ApexChart>, <SparklineChart>
|
|
90
|
+
npm install tabulator-tables # <Datatable>
|
|
91
|
+
npm install quill # <Editor>
|
|
92
|
+
npm install flatpickr # <InputFlatpickr>
|
|
93
|
+
npm install tom-select # <InputTomSelect>
|
|
94
|
+
npm install jsvectormap # <WorldMap>
|
|
95
|
+
npm install sortablejs # useSortable()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each also needs its own CSS loaded once. See the **Plugins & Dynamic Imports** docs page
|
|
99
|
+
for the full matrix.
|
|
100
|
+
|
|
101
|
+
## Quick Start
|
|
102
|
+
|
|
103
|
+
### 1. Import CSS in your Next.js layout
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
// app/layout.tsx
|
|
107
|
+
import 'adminlte-react/css'
|
|
108
|
+
import 'bootstrap-icons/font/bootstrap-icons.css'
|
|
109
|
+
import './globals.css'
|
|
110
|
+
|
|
111
|
+
export const metadata = {
|
|
112
|
+
title: 'Dashboard',
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export default function RootLayout({ children }) {
|
|
116
|
+
return (
|
|
117
|
+
<html lang="en">
|
|
118
|
+
<head>
|
|
119
|
+
<link
|
|
120
|
+
rel="stylesheet"
|
|
121
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.css"
|
|
122
|
+
/>
|
|
123
|
+
</head>
|
|
124
|
+
<body>
|
|
125
|
+
{children}
|
|
126
|
+
{/* Bootstrap JS required for dropdowns, modals, etc */}
|
|
127
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
|
|
128
|
+
</body>
|
|
129
|
+
</html>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 2. Create a dashboard layout
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
// app/(dashboard)/layout.tsx
|
|
138
|
+
import { DashboardLayout } from 'adminlte-react'
|
|
139
|
+
import { menuItems } from '@/lib/menu'
|
|
140
|
+
|
|
141
|
+
export default function Layout({ children }) {
|
|
142
|
+
return (
|
|
143
|
+
<DashboardLayout
|
|
144
|
+
menuItems={menuItems}
|
|
145
|
+
fixedHeader
|
|
146
|
+
fixedSidebar
|
|
147
|
+
colorModeToggle
|
|
148
|
+
>
|
|
149
|
+
{children}
|
|
150
|
+
</DashboardLayout>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 3. Define your menu
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
// lib/menu.ts
|
|
159
|
+
import type { MenuNode } from 'adminlte-react'
|
|
160
|
+
|
|
161
|
+
export const menuItems: MenuNode[] = [
|
|
162
|
+
{
|
|
163
|
+
type: 'group',
|
|
164
|
+
text: 'Dashboard',
|
|
165
|
+
icon: 'bi-speedometer',
|
|
166
|
+
children: [
|
|
167
|
+
{
|
|
168
|
+
type: 'item',
|
|
169
|
+
text: 'Dashboard v1',
|
|
170
|
+
href: '/',
|
|
171
|
+
icon: 'bi-circle',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: 'header',
|
|
177
|
+
text: 'UI ELEMENTS',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: 'item',
|
|
181
|
+
text: 'Profile',
|
|
182
|
+
href: '/profile',
|
|
183
|
+
icon: 'bi-person',
|
|
184
|
+
},
|
|
185
|
+
]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 4. Build dashboard pages
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
// app/(dashboard)/page.tsx
|
|
192
|
+
import { AppContent, SmallBox, Card, Progress } from 'adminlte-react'
|
|
193
|
+
|
|
194
|
+
export default function Dashboard() {
|
|
195
|
+
return (
|
|
196
|
+
<AppContent
|
|
197
|
+
title="Dashboard"
|
|
198
|
+
breadcrumbs={[
|
|
199
|
+
{ label: 'Home', href: '/' },
|
|
200
|
+
{ label: 'Dashboard' },
|
|
201
|
+
]}
|
|
202
|
+
>
|
|
203
|
+
<div className="row">
|
|
204
|
+
<div className="col-lg-3 col-6">
|
|
205
|
+
<SmallBox
|
|
206
|
+
title="53"
|
|
207
|
+
text="New Orders"
|
|
208
|
+
theme="primary"
|
|
209
|
+
icon={<i className="bi bi-bag-check"></i>}
|
|
210
|
+
url="#"
|
|
211
|
+
/>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<div className="row mt-4">
|
|
216
|
+
<div className="col-md-6">
|
|
217
|
+
<Card title="Sales Chart" theme="primary">
|
|
218
|
+
{/* Your chart here */}
|
|
219
|
+
</Card>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</AppContent>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Components
|
|
228
|
+
|
|
229
|
+
### Layout
|
|
230
|
+
|
|
231
|
+
- **`DashboardLayout`** - Main app shell (RSC) with sidebar, topbar, footer & command palette
|
|
232
|
+
- **`AuthLayout`** - Standalone auth page layout (login, register)
|
|
233
|
+
- **`AppContent`** - Page content wrapper with title and breadcrumbs
|
|
234
|
+
- Lower-level pieces are also exported: `Topbar`, `Sidebar`, `SidebarBrand`, `SidebarNav`, `SidebarNavItem`, `SidebarOverlay`, `Footer`, `ColorModeToggle`
|
|
235
|
+
|
|
236
|
+
### Widgets
|
|
237
|
+
|
|
238
|
+
- **`SmallBox`** - Colored stat tile with footer link
|
|
239
|
+
- **`InfoBox`** - Metric widget with optional progress bar
|
|
240
|
+
- **`Card`** - Collapsible / maximizable / removable card container
|
|
241
|
+
- **`Alert`** - Alert message with optional icon, title & dismiss
|
|
242
|
+
- **`Callout`** - Highlighted informational block
|
|
243
|
+
- **`Progress`** / **`ProgressGroup`** - Single bar / labeled group
|
|
244
|
+
- **`Ratings`** - Star ratings display
|
|
245
|
+
- **`ProfileCard`** - User profile card with social links
|
|
246
|
+
- **`DescriptionBlock`** - Label/value blocks
|
|
247
|
+
- **`Timeline`** - Chronological timeline
|
|
248
|
+
- **`NavMessages`** / **`NavNotifications`** / **`NavTasks`** - Topbar dropdown widgets
|
|
249
|
+
- **`DirectChat`** - Chat widget with contacts pane
|
|
250
|
+
- **`ApexChart`** / **`SparklineChart`** - ApexCharts wrappers (dynamic import)
|
|
251
|
+
- **`WorldMap`** - jsVectorMap world map (dynamic import)
|
|
252
|
+
- **`CommandPalette`** - ⌘K searchable navigator (+ `flattenMenuToCommands` helper)
|
|
253
|
+
- **`Accordion`** / **`Tabs`** - Collapsible panels & tab/pill switcher (state-driven, no Bootstrap JS)
|
|
254
|
+
- **`Toast`** / **`Tooltip`** - Controlled toast notification & hover/focus tooltip
|
|
255
|
+
|
|
256
|
+
### Forms
|
|
257
|
+
|
|
258
|
+
- **`Button`** - Themed button with variants, sizes, icon
|
|
259
|
+
- **`Input`** / **`Textarea`** - Text inputs with label, hint & error
|
|
260
|
+
- **`Select`** - Dropdown select (options or children)
|
|
261
|
+
- **`InputSwitch`** - Toggle switch
|
|
262
|
+
- **`InputColor`** - Native color picker
|
|
263
|
+
- **`InputFile`** - File input (single/multiple)
|
|
264
|
+
- **`InputFlatpickr`** - Date/time picker (dynamic import)
|
|
265
|
+
- **`InputTomSelect`** - Searchable / multi-select (dynamic import)
|
|
266
|
+
|
|
267
|
+
### Tools
|
|
268
|
+
|
|
269
|
+
- **`Modal`** - Bootstrap modal dialog
|
|
270
|
+
- **`Datatable`** - Data grid with Tabulator (dynamic import)
|
|
271
|
+
- **`Editor`** - Rich text editor with Quill (dynamic import)
|
|
272
|
+
|
|
273
|
+
## Context & Hooks
|
|
274
|
+
|
|
275
|
+
`DashboardLayout` provides three contexts. Each has a hook (use them in client components):
|
|
276
|
+
|
|
277
|
+
- **`useSidebarContext()`** → `{ isCollapsed, isMobileOpen, isMiniMode, toggle, collapse, expand, sidebarBreakpoint }`
|
|
278
|
+
- **`useColorModeContext()`** → `{ colorMode, setColorMode, resolvedMode }`
|
|
279
|
+
- **`useCommandPalette()`** → `{ isOpen, open, close, toggle }` (or `undefined` outside the provider)
|
|
280
|
+
|
|
281
|
+
Standalone hooks:
|
|
282
|
+
|
|
283
|
+
- **`usePushMenu(options?)`** - Sidebar state machine (used by `SidebarProvider`)
|
|
284
|
+
- **`useCardWidget(initialCollapsed?)`** - Card collapse / maximize / remove state
|
|
285
|
+
- **`useDirectChat()`** - Toggle the chat contacts pane
|
|
286
|
+
- **`useFullscreen()`** - Fullscreen API wrapper
|
|
287
|
+
- **`useTreeviewAnimation(isOpen, speed?)`** - Animate a collapsible `<ul>` height
|
|
288
|
+
- **`useSortable(enabled?)`** - Drag-and-drop on `.connectedSortable` lists (SortableJS)
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
'use client'
|
|
292
|
+
import { useSidebarContext, useColorModeContext } from 'adminlte-react'
|
|
293
|
+
|
|
294
|
+
function Toolbar() {
|
|
295
|
+
const { toggle } = useSidebarContext()
|
|
296
|
+
const { setColorMode } = useColorModeContext()
|
|
297
|
+
return (
|
|
298
|
+
<>
|
|
299
|
+
<button onClick={toggle}>Toggle sidebar</button>
|
|
300
|
+
<button onClick={() => setColorMode('dark')}>Dark mode</button>
|
|
301
|
+
</>
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Styling
|
|
307
|
+
|
|
308
|
+
All components use Bootstrap 5.3 utility classes. Customize via CSS variables or override classes:
|
|
309
|
+
|
|
310
|
+
```css
|
|
311
|
+
:root {
|
|
312
|
+
--bs-primary: #0d6efd;
|
|
313
|
+
--bs-secondary: #6c757d;
|
|
314
|
+
/* ... other variables */
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Type Safety
|
|
319
|
+
|
|
320
|
+
Full TypeScript support with exported types:
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
import type { DashboardLayoutProps, MenuNode, BootstrapTheme } from 'adminlte-react'
|
|
324
|
+
|
|
325
|
+
const props: DashboardLayoutProps = {
|
|
326
|
+
menuItems: [],
|
|
327
|
+
colorModeToggle: true,
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Dark Mode
|
|
332
|
+
|
|
333
|
+
Dark mode is handled automatically by `ColorModeProvider` (inside `DashboardLayout`). It sets `data-bs-theme` on `<html>`, resolves `auto` from `prefers-color-scheme`, and persists the user's choice in localStorage under the key `lte-theme`.
|
|
334
|
+
|
|
335
|
+
Set the starting mode with `initialColorMode` on `DashboardLayout`, or mount the provider directly:
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
<ColorModeProvider initialMode="dark">
|
|
339
|
+
{children}
|
|
340
|
+
</ColorModeProvider>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Accessibility
|
|
344
|
+
|
|
345
|
+
Components are built with accessibility in mind:
|
|
346
|
+
|
|
347
|
+
- Semantic HTML and ARIA landmarks
|
|
348
|
+
- Keyboard navigation (including the ⌘K command palette)
|
|
349
|
+
- Focus management
|
|
350
|
+
- Reduced-motion friendly animations
|
|
351
|
+
|
|
352
|
+
## Browser Support
|
|
353
|
+
|
|
354
|
+
Modern evergreen browsers — latest Chrome, Firefox, Safari, and Edge.
|
|
355
|
+
|
|
356
|
+
## Performance
|
|
357
|
+
|
|
358
|
+
- **RSC-optimized** - Presentational components render on the server; only interactive parts hydrate
|
|
359
|
+
- **Lazy plugins** - Chart, map, datatable, editor, and advanced form libraries load on demand via dynamic `import()`
|
|
360
|
+
- **CSS-in-JS free** - Plain Bootstrap classes and CSS variables
|
|
361
|
+
- **Tree-shakeable** - ESM build with `sideEffects` scoped to the stylesheet, so unused components are dropped
|
|
362
|
+
|
|
363
|
+
## Contributing
|
|
364
|
+
|
|
365
|
+
Contributions are welcome! Open an issue or pull request on
|
|
366
|
+
[GitHub](https://github.com/ColorlibHQ/adminlte-react). Build the library with
|
|
367
|
+
`pnpm build` and run `pnpm type-check` before submitting.
|
|
368
|
+
|
|
369
|
+
## Upgrade to a Premium Dashboard
|
|
370
|
+
|
|
371
|
+
Need advanced features, more pages, and dedicated support? Explore Colorlib's collection of professional admin templates on [DashboardPack](https://dashboardpack.com/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react).
|
|
372
|
+
|
|
373
|
+
<table>
|
|
374
|
+
<tr>
|
|
375
|
+
<td align="center" width="50%">
|
|
376
|
+
<a href="https://dashboardpack.com/theme-details/apex-dashboard-nextjs/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react">
|
|
377
|
+
<img src="docs/screenshots/dashboardpack/apex.png" alt="Apex Dashboard — Next.js admin template with shadcn/ui" width="100%">
|
|
378
|
+
</a>
|
|
379
|
+
<br>
|
|
380
|
+
<a href="https://dashboardpack.com/theme-details/apex-dashboard-nextjs/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react"><strong>Apex Dashboard</strong></a>
|
|
381
|
+
<br>
|
|
382
|
+
<sub>Next.js 16 + React 19 + Tailwind CSS v4 + shadcn/ui. 5 dashboard variants, 20+ app pages, 125+ routes, full CRUD.</sub>
|
|
383
|
+
</td>
|
|
384
|
+
<td align="center" width="50%">
|
|
385
|
+
<a href="https://dashboardpack.com/theme-details/zenith-shadcn/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react">
|
|
386
|
+
<img src="docs/screenshots/dashboardpack/zenith.png" alt="Zenith — minimal Next.js admin dashboard with shadcn/ui" width="100%">
|
|
387
|
+
</a>
|
|
388
|
+
<br>
|
|
389
|
+
<a href="https://dashboardpack.com/theme-details/zenith-shadcn/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react"><strong>Zenith Dashboard</strong></a>
|
|
390
|
+
<br>
|
|
391
|
+
<sub>Next.js 16 + React 19 + Tailwind CSS v4 + shadcn/ui. Achromatic design, 50+ pages, 6 dashboards, live theme customizer.</sub>
|
|
392
|
+
</td>
|
|
393
|
+
</tr>
|
|
394
|
+
<tr>
|
|
395
|
+
<td align="center" width="50%">
|
|
396
|
+
<a href="https://dashboardpack.com/theme-details/haze-dashboard-nuxt/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react">
|
|
397
|
+
<img src="docs/screenshots/dashboardpack/haze.png" alt="Haze — Nuxt 4 admin dashboard with 92+ pages" width="100%">
|
|
398
|
+
</a>
|
|
399
|
+
<br>
|
|
400
|
+
<a href="https://dashboardpack.com/theme-details/haze-dashboard-nuxt/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react"><strong>Haze</strong></a>
|
|
401
|
+
<br>
|
|
402
|
+
<sub>Nuxt 4 + Nuxt UI v4 + Tailwind CSS v4. 92+ pages, 7 layouts, 5 dashboards, RTL, i18n, mock API layer.</sub>
|
|
403
|
+
</td>
|
|
404
|
+
<td align="center" width="50%">
|
|
405
|
+
<a href="https://dashboardpack.com/theme-details/tailpanel/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react">
|
|
406
|
+
<img src="docs/screenshots/dashboardpack/tailpanel.png" alt="TailPanel — React and Tailwind CSS admin panel" width="100%">
|
|
407
|
+
</a>
|
|
408
|
+
<br>
|
|
409
|
+
<a href="https://dashboardpack.com/theme-details/tailpanel/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react"><strong>TailPanel</strong></a>
|
|
410
|
+
<br>
|
|
411
|
+
<sub>React + TypeScript + Tailwind CSS + Vite. 9 dashboard designs, dark and light themes.</sub>
|
|
412
|
+
</td>
|
|
413
|
+
</tr>
|
|
414
|
+
<tr>
|
|
415
|
+
<td align="center" width="50%">
|
|
416
|
+
<a href="https://dashboardpack.com/theme-details/admindek-html/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react">
|
|
417
|
+
<img src="docs/screenshots/dashboardpack/admindek.png" alt="Admindek — feature-rich Bootstrap 5 dashboard" width="100%">
|
|
418
|
+
</a>
|
|
419
|
+
<br>
|
|
420
|
+
<a href="https://dashboardpack.com/theme-details/admindek-html/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react"><strong>Admindek</strong></a>
|
|
421
|
+
<br>
|
|
422
|
+
<sub>Bootstrap 5 + vanilla JS. 100+ components, dark/light modes, RTL support, 10 color presets.</sub>
|
|
423
|
+
</td>
|
|
424
|
+
<td align="center" width="50%">
|
|
425
|
+
<a href="https://dashboardpack.com/theme-details/svelteforge-premium/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react">
|
|
426
|
+
<img src="docs/screenshots/dashboardpack/svelteforge.png" alt="SvelteForge Premium — SvelteKit admin dashboard" width="100%">
|
|
427
|
+
</a>
|
|
428
|
+
<br>
|
|
429
|
+
<a href="https://dashboardpack.com/theme-details/svelteforge-premium/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react"><strong>SvelteForge Premium</strong></a>
|
|
430
|
+
<br>
|
|
431
|
+
<sub>SvelteKit + Tailwind CSS v4. 30+ wired-up modules, multi-tenant from row zero, dark/light/system mode.</sub>
|
|
432
|
+
</td>
|
|
433
|
+
</tr>
|
|
434
|
+
</table>
|
|
435
|
+
|
|
436
|
+
<p align="center">
|
|
437
|
+
<a href="https://dashboardpack.com/?utm_source=github&utm_medium=readme&utm_campaign=adminlte-react"><strong>View All Premium Templates →</strong></a>
|
|
438
|
+
</p>
|
|
439
|
+
|
|
440
|
+
## License
|
|
441
|
+
|
|
442
|
+
MIT © [Colorlib](https://colorlib.com)
|
|
443
|
+
|
|
444
|
+
## Resources
|
|
445
|
+
|
|
446
|
+
- [AdminLTE Documentation](https://adminlte.io)
|
|
447
|
+
- [Bootstrap 5 Documentation](https://getbootstrap.com/docs/5.3/)
|
|
448
|
+
- [Bootstrap Icons](https://icons.getbootstrap.com/)
|
|
449
|
+
|
|
450
|
+
## Support
|
|
451
|
+
|
|
452
|
+
For issues, feature requests, or questions:
|
|
453
|
+
- [GitHub Issues](https://github.com/ColorlibHQ/adminlte-react/issues)
|
|
454
|
+
- [GitHub Discussions](https://github.com/ColorlibHQ/adminlte-react/discussions)
|