Components
The React components of AdminKit for Next.js and their props: modal, offcanvas, dropdown, alert, accordion, collapse, tabs, toasts, tooltips and plugins.
AdminKit for Next.js has no Bootstrap JavaScript and no react-bootstrap. The components in src/components/bootstrap/ render Bootstrap's markup and classes, and React state opens and closes them; Bootstrap's Sass gives them their look and transitions. Floating UI positions dropdowns, tooltips and popovers, and modals and offcanvas sheets keep the focus inside while they are open. Everything else, such as buttons, cards, forms and tables, is plain Bootstrap markup in JSX (className instead of class), as in the AdminKit for Bootstrap docs.
The components are client components, so a server component page can render them, except Tooltip and Popover, which go in a client component. Props not listed below, such as className, id and aria-*, go to the component's root element.
| Component | File | Edition |
|---|---|---|
Alert | alert.tsx | Free and PRO |
CloseButton | close-button.tsx | Free and PRO |
Dropdown, DropdownToggle, DropdownMenu | dropdown.tsx | Free and PRO |
Modal | modal.tsx | Free and PRO |
Offcanvas | offcanvas.tsx | Free and PRO |
Accordion, AccordionItem, AccordionHeader, AccordionBody | accordion.tsx | PRO |
Collapse | collapse.tsx | PRO |
TabContainer, TabLink, TabPane | tabs.tsx | PRO |
Toast, useToast | toast.tsx | PRO |
Tooltip, Popover | overlay.tsx | PRO |
Modal
The children are the .modal-content. The parent holds the open state:
"use client";
import { useState } from "react";
import { CloseButton } from "@/components/bootstrap/close-button";
import { Modal } from "@/components/bootstrap/modal";
export function DeleteProject() {
const [show, setShow] = useState(false);
const close = () => setShow(false);
return (
<>
<button type="button" className="btn btn-danger" onClick={() => setShow(true)}>
Delete project
</button>
<Modal show={show} onHide={close} aria-labelledby="delete-title">
<div className="modal-header">
<h2 className="modal-title h5" id="delete-title">Delete project</h2>
<CloseButton onClick={close} />
</div>
<div className="modal-body">This cannot be undone.</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" onClick={close}>Cancel</button>
<button type="button" className="btn btn-danger" onClick={close}>Delete</button>
</div>
</Modal>
</>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
show | boolean | Whether the modal is open | |
onHide | () => void | Called on Escape and on a backdrop click; set show to false here | |
onExited | () => void | Called once the modal has faded out | |
backdrop | boolean | "static" | true | "static": a click outside shakes the dialog instead of closing it |
keyboard | boolean | true | Escape closes the modal |
dialogClassName | string | Classes for .modal-dialog: modal-lg, modal-dialog-centered, ... | |
contentClassName | string | Classes for .modal-content | |
contentAs | ElementType | "div" | "form" for a dialog that is a form |
contentProps | object | Other props for .modal-content, such as onSubmit |
Offcanvas
<Offcanvas show={show} onHide={() => setShow(false)} placement="end" aria-labelledby="filters-title">
<div className="offcanvas-header">
<h2 className="offcanvas-title h5" id="filters-title">Filters</h2>
<CloseButton onClick={() => setShow(false)} />
</div>
<div className="offcanvas-body">...</div>
</Offcanvas>| Prop | Type | Default | Description |
|---|---|---|---|
show, onHide | As for Modal | ||
onShown, onHidden | () => void | Called when the transition has finished | |
placement | "start" | "end" | "top" | "bottom" | "start" | The side it slides in from |
responsive | "sm" | "md" | "lg" | "xl" | "xxl" | An offcanvas only below this breakpoint, part of the page from it up (the sidebar uses "lg") | |
backdrop | boolean | "static" | true | |
scroll | boolean | false | Keeps the page scrollable while it is open |
keyboard | boolean | true | Escape closes it |
as | ElementType | "div" | The element, such as "nav" |
Dropdown
<Dropdown>
<DropdownToggle as="button" type="button" className="btn btn-primary dropdown-toggle">
Actions
</DropdownToggle>
<DropdownMenu className="dropdown-menu-end">
<a className="dropdown-item" href="#">Edit</a>
<a className="dropdown-item" href="#">Archive</a>
</DropdownMenu>
</Dropdown>| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | "div" | The wrapper, such as "li" in a navbar |
display | "dynamic" | "static" | "dynamic" | "static" leaves the menu where the CSS puts it, as in a navbar; "dynamic" positions it and flips it to stay in view |
strategy | "absolute" | "fixed" | "absolute" | "fixed" lets the menu escape containers that clip or scroll |
autoClose | boolean | "inside" | "outside" | true | Which clicks close the menu; false leaves it to the toggle |
drop | "down" | "up" | "start" | "end" | from the class | The side the menu opens on; read from dropup, dropend or dropstart |
DropdownToggle is a link (href="#") unless as="button". DropdownMenu takes as and align ("start" or "end", read from .dropdown-menu-end).
Alert
<Alert variant="success" dismissible>
Your changes have been saved.
</Alert>variant is a theme color ("primary" by default). With dismissible the alert gets a close button and fades out when it is closed; onClose is called after that.
CloseButton is Bootstrap's .btn-close with aria-label="Close"; white gives it the light variant for dark backgrounds.
Accordion
This component is only available in AdminKit PRO. Learn more.
<Accordion defaultActiveKey="shipping">
<AccordionItem eventKey="shipping">
<AccordionHeader>Shipping</AccordionHeader>
<AccordionBody>Orders ship within two days.</AccordionBody>
</AccordionItem>
<AccordionItem eventKey="returns">
<AccordionHeader>Returns</AccordionHeader>
<AccordionBody>Return an order within a month.</AccordionBody>
</AccordionItem>
</Accordion>Accordion takes defaultActiveKey (a key or a list of keys) and alwaysOpen, which keeps items open when another opens. AccordionHeader is an h2 unless as says "h3" to "h6".
Collapse
This component is only available in AdminKit PRO. Learn more.
Collapse shows and hides its content with Bootstrap's height transition:
<button
type="button"
className="btn btn-light"
aria-expanded={open}
aria-controls="details"
onClick={() => setOpen(!open)}
>
Details
</button>
<Collapse in={open} id="details">
<div className="pt-3">...</div>
</Collapse>Props: in (shown or not), as (the element, "div" by default), onEntered and onExited.
Tabs
This component is only available in AdminKit PRO. Learn more.
Write the nav and the panes as in Bootstrap; TabLink and TabPane connect them by eventKey:
<TabContainer defaultActiveKey="profile">
<ul className="nav nav-tabs" role="tablist">
<li className="nav-item" role="presentation">
<TabLink eventKey="profile" className="nav-link">Profile</TabLink>
</li>
<li className="nav-item" role="presentation">
<TabLink eventKey="security" className="nav-link">Security</TabLink>
</li>
</ul>
<div className="tab-content">
<TabPane eventKey="profile">...</TabPane>
<TabPane eventKey="security">...</TabPane>
</div>
</TabContainer>TabContainer takes defaultActiveKey, or activeKey and onSelect to control the tab yourself. TabLink takes as and disabled; TabPane fades in unless fade={false}.
Toasts
This component is only available in AdminKit PRO. Learn more.
useToast() returns a function that shows a toast in a corner of the window. ToastProvider in src/app/layout.tsx renders them.
"use client";
import { useToast } from "@/components/bootstrap/toast";
export function SaveButton() {
const showToast = useToast();
return (
<button
type="button"
className="btn btn-primary"
onClick={() => showToast({ message: "Saved", type: "success" })}
>
Save
</button>
);
}| Option | Type | Default | Description |
|---|---|---|---|
message | ReactNode | The text | |
type | "default" | "primary" | "secondary" | "success" | "info" | "warning" | "danger" | "primary" | The color |
duration | number | 5000 | Milliseconds before it hides; 0 keeps it until it is closed |
dismissible | boolean | Adds a close button | |
position | { x: "left" | "center" | "right"; y: "top" | "bottom" } | top right | The corner |
Toast is a single Bootstrap toast, for toasts you place yourself: show, onClose, autohide and delay (5000).
Tooltip and Popover
These components are only available in AdminKit PRO. Learn more.
Both wrap one element and attach the tooltip or popover to it:
<Tooltip content="Archive the project">
<button type="button" className="btn btn-light">Archive</button>
</Tooltip>
<Popover title="Billing" content="Invoices are sent on the 1st.">
<button type="button" className="btn btn-light">Billing</button>
</Popover>A tooltip shows on hover and focus, above the element; a popover opens on click, to its right. placement ("top", "bottom", "left" or "right") and trigger (a list of "hover", "focus" and "click") change that.
Plugins
The plugins have a wrapper component in src/components/plugins/. Each loads its library in the browser and shows a Skeleton until it has drawn, so the page keeps its size.
| Component | Library | Edition |
|---|---|---|
ChartJs | Chart.js | Free and PRO, see Charts |
VectorMap | jsVectorMap | Free and PRO, see Charts |
VanillaCalendar | Vanilla Calendar Pro | Free and PRO |
ApexChart | ApexCharts | PRO, see Charts |
DataTable | DataTables (datatables.net-react) | PRO |
FullCalendar | FullCalendar (@fullcalendar/react) | PRO |
QuillEditor | Quill | PRO |
MaskedInput | Inputmask | PRO |
Select | React Select | PRO |
The scrollbars use simplebar-react directly, and the tasks board of AdminKit PRO uses dnd kit. Examples:
<VanillaCalendar options={{ selectedDates: [today] }} />
<DataTable data={rows} columns={columns} options={{ responsive: true }} className="table table-striped" />
<FullCalendar initialView="dayGridMonth" editable events={events} />
<QuillEditor theme="snow" defaultValue="<p>Hello</p>" onChange={(html) => setBody(html)} />
<MaskedInput className="form-control" mask="(999) 999-9999" />
<Select options={options} isMulti aria-labelledby="states-label" />DataTable, FullCalendar and Select take the props of the library's React component. VanillaCalendar takes Vanilla Calendar Pro's options; in AdminKit PRO, input turns it into a date picker on an input and time adds the time picker. QuillEditor and MaskedInput are uncontrolled: read their value from onChange or from the form.
UI components
| Component | File | Description |
|---|---|---|
PageTitle | ui/page-title.tsx | The page heading (title), with a badge that links to the PRO upgrade page in the free version; in AdminKit PRO, pro adds a "Pro Component" badge |
CountUp | ui/count-up.tsx | A number that counts up when it scrolls into view; value is the final text, such as "$21,300" |
Skeleton | ui/skeleton.tsx | The loading placeholder of the plugin components |
Footer | ui/footer.tsx | The page footer, see Sidebar |
CardActions | ui/card-actions.tsx | The menu in a card header, PRO |
Last updated on
Dark mode
Light, dark and auto color modes in AdminKit for Next.js: data-bs-theme set before the first paint, the useColorMode hook, the toggle and useTheme colors.
Sidebar
The sidebar, navbar and footer of AdminKit for Next.js: the menu in src/data/navigation.ts, the offcanvas sheet on small screens and the toggle.