getting-started.mdx 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. AdminLTE is an HTML template — there's no build step required to use it. This page gets you to a working dashboard in about ten minutes, without npm, without a build pipeline, without learning Astro.
  2. If you're integrating AdminLTE into a real project, the [Installation](introduction.html) page covers npm, Composer, and source-build workflows.
  3. ##### 1. Grab the CDN snippets
  4. Copy these tags into the `<head>` of a new HTML file. They pull AdminLTE, Bootstrap 5.3, Popper, OverlayScrollbars, and Bootstrap Icons from jsDelivr — no install needed.
  5. ```html
  6. <!-- AdminLTE 4 + Bootstrap 5.3 (CSS) -->
  7. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css" />
  8. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.11.0/styles/overlayscrollbars.min.css" />
  9. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@4.0.0-rc7/dist/css/adminlte.min.css" />
  10. ```
  11. And these just before `</body>`:
  12. ```html
  13. <!-- Bootstrap + Popper + AdminLTE (JS) -->
  14. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"></script>
  15. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.min.js"></script>
  16. <script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.11.0/browser/overlayscrollbars.browser.es6.min.js"></script>
  17. <script src="https://cdn.jsdelivr.net/npm/admin-lte@4.0.0-rc7/dist/js/adminlte.min.js"></script>
  18. ```
  19. ##### 2. The minimum viable layout
  20. This is the smallest AdminLTE page that still feels like AdminLTE — a header, a collapsible sidebar, and a main content area. Drop it between the CSS and JS tags above:
  21. ```html
  22. <body class="layout-fixed sidebar-expand-lg bg-body-tertiary">
  23. <div class="app-wrapper">
  24. <!-- Header -->
  25. <nav class="app-header navbar navbar-expand bg-body">
  26. <div class="container-fluid">
  27. <ul class="navbar-nav">
  28. <li class="nav-item">
  29. <a class="nav-link" data-lte-toggle="sidebar" href="#" role="button">
  30. <i class="bi bi-list"></i>
  31. </a>
  32. </li>
  33. </ul>
  34. </div>
  35. </nav>
  36. <!-- Sidebar -->
  37. <aside class="app-sidebar bg-body-secondary shadow" data-bs-theme="dark">
  38. <div class="sidebar-brand">
  39. <a href="#" class="brand-link">
  40. <span class="brand-text fw-light">My Dashboard</span>
  41. </a>
  42. </div>
  43. <div class="sidebar-wrapper">
  44. <nav class="mt-2">
  45. <ul class="nav sidebar-menu flex-column" data-lte-toggle="treeview" role="menu">
  46. <li class="nav-item">
  47. <a href="#" class="nav-link active">
  48. <i class="nav-icon bi bi-speedometer"></i>
  49. <p>Dashboard</p>
  50. </a>
  51. </li>
  52. <li class="nav-item">
  53. <a href="#" class="nav-link">
  54. <i class="nav-icon bi bi-bar-chart"></i>
  55. <p>Reports</p>
  56. </a>
  57. </li>
  58. </ul>
  59. </nav>
  60. </div>
  61. </aside>
  62. <!-- Main content -->
  63. <main class="app-main">
  64. <div class="app-content-header">
  65. <div class="container-fluid">
  66. <h3 class="mb-0">Hello, AdminLTE</h3>
  67. </div>
  68. </div>
  69. <div class="app-content">
  70. <div class="container-fluid">
  71. <div class="card">
  72. <div class="card-header"><h5 class="card-title">Welcome</h5></div>
  73. <div class="card-body">
  74. Edit this file to start building your dashboard.
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </main>
  80. </div>
  81. </body>
  82. ```
  83. Open it in a browser. The hamburger button at the top-left collapses the sidebar — that's AdminLTE's [PushMenu](javascript/pushmenu.html) plugin working out of the box, wired by `data-lte-toggle="sidebar"`.
  84. ##### 3. What's actually happening
  85. The four classes that do the heavy lifting:
  86. | Class | What it does |
  87. |---|---|
  88. | `app-wrapper` | The CSS grid root — defines header / sidebar / main / footer regions |
  89. | `app-header` | Stuck to the top of the viewport when `layout-fixed` is on the body |
  90. | `app-sidebar` | Collapsible side rail. Add `sidebar-expand-lg` to body to control breakpoint |
  91. | `app-main` | Scrollable content region — everything else lives here |
  92. The [Layout](layout.html) page covers the full wrapper structure and the responsive options.
  93. ##### 4. Add a working JavaScript widget
  94. AdminLTE ships seven JavaScript plugins. All of them are wired via `data-lte-*` attributes — no JavaScript code needed.
  95. Drop this in the content area to see the card-widget plugin in action (try the buttons in the card header):
  96. ```html
  97. <div class="card">
  98. <div class="card-header">
  99. <h5 class="card-title">Collapsible card</h5>
  100. <div class="card-tools">
  101. <button type="button" class="btn btn-sm btn-tool" data-lte-toggle="card-collapse">
  102. <i data-lte-icon="expand" class="bi bi-dash-lg"></i>
  103. <i data-lte-icon="collapse" class="bi bi-plus-lg"></i>
  104. </button>
  105. <button type="button" class="btn btn-sm btn-tool" data-lte-toggle="card-remove">
  106. <i class="bi bi-x-lg"></i>
  107. </button>
  108. </div>
  109. </div>
  110. <div class="card-body">
  111. Click the minus icon to collapse; the X to remove.
  112. </div>
  113. </div>
  114. ```
  115. ##### 5. Where to go next
  116. You now have a working AdminLTE page. From here:
  117. - **Make it pretty** → [Customization & Theming](customization.html) — change colors, fonts, and spacing via SCSS variables or CSS custom properties.
  118. - **Make it functional** → [JavaScript Plugins](javascript/layout.html) — full reference for all seven plugins.
  119. - **Make it dark** → [Color Mode](color-mode.html) — light/dark/auto toggle.
  120. - **Make it international** → [RTL Support](rtl.html) — right-to-left layouts for Arabic, Hebrew, Persian, etc.
  121. - **Add real widgets** → [Recommended Integrations](integrations.html) — date pickers, multi-selects, charts, rich text editors. AdminLTE keeps its dep tree lean; this page tells you which third-party libraries to drop in.
  122. If you're upgrading an existing AdminLTE 3 project, see the [Migration from v3](migration.html) guide for breaking changes.