A premium configurable toolbar with golden glow & 60+ icons
A premium, configurable toolbar/menu UI component library. Zero dependencies — pure vanilla JS & CSS, under 20 KB total. Drop it into any web app and get an animated, themeable navigation bar in minutes.
All options are passed as a single object to new ToolbarX(options). Only container is required.
| Option | Type | Default | Description |
|---|---|---|---|
container required |
string | Element |
— | CSS selector or DOM element to render into |
theme |
string |
'dark' |
'dark' or 'light' |
orientation |
string |
'horizontal' |
'horizontal' or 'vertical' |
items |
Array |
[] |
Array of { id, icon, label } objects |
activeItem |
string |
first item | ID of the initially active item |
showThemeToggle |
boolean |
true |
Show the built-in theme toggle button |
responsive |
boolean |
true |
Auto-scale via ResizeObserver when container is narrow |
customIcons |
object |
{} |
Map of custom icons { name: svgString } |
onSelect |
function |
null |
Called on item click: (item) => {} |
onThemeChange |
function |
null |
Called when theme changes: (theme) => {} |
onOrientationChange |
function |
null |
Called when orientation changes: (orientation) => {} |
Dimension options can be set in the constructor alongside other options, or updated live via setDimensions(). All values are in pixels.
| Option | Default | Description |
|---|---|---|
itemSize |
72 |
Item cell width and height (px) |
iconSize |
30 |
SVG icon render size (px) |
outerPadding |
10 |
Outer container padding (px) |
innerPadding |
6 |
Inner track padding (px) |
outerRadius |
28 |
Outer container border radius (px) |
innerRadius |
20 |
Inner track border radius (px) |
itemRadius |
18 |
Item button and pill border radius (px) |
glowSpread |
5 |
Golden glow spread radius around the active pill (px) |
sectionGap |
10 |
Gap between the item track and the theme toggle (px) |
All methods are called on the ToolbarX instance returned by the constructor.
| Method | Description |
|---|---|
setActive(id) |
Animate the pill to the item with the given ID |
setTheme('dark' | 'light') |
Switch to the specified theme |
toggleTheme() |
Toggle between dark and light themes |
setOrientation('horizontal' | 'vertical') |
Change the toolbar layout orientation |
setDimensions({ ... }) |
Update one or more dimension values live; accepts any subset of dimension options |
registerIcon(name, svg) |
Register a custom icon on this instance (string or function) |
getAvailableIcons() |
Returns an array of all icon names available to this instance (built-in + custom) |
getTheme() |
Returns the current theme string ('dark' or 'light') |
getActiveItem() |
Returns the currently active item ID |
getOrientation() |
Returns the current orientation string |
destroy() |
Remove the toolbar from the DOM and disconnect all observers/listeners |
60+ SVG icons are included across 10 categories. All icons use currentColor, so they automatically adapt to the active theme. Use any icon name as the icon field on a toolbar item.
| Category | Icon names |
|---|---|
| Navigation | home grid menu compass map arrow-left arrow-right |
| Search | search filter |
| User & Social | user users user-plus heart thumbs-up share |
| Communication | bell mail message-circle phone send |
| Commerce | wallet credit-card shopping-cart shopping-bag tag dollar-sign gift |
| Data | chart bar-chart pie-chart trending-up activity layers |
| Files | folder file clipboard download upload image |
| Media | play pause music camera video mic |
| Dev & Tools | settings sliders terminal code database cloud lock unlock key |
| Misc | star bookmark flag alert-circle check-circle clock calendar globe link external-link trash edit plus minus x refresh eye print |
There are three ways to bring your own icons.
ToolbarX uses constructor callbacks rather than DOM events. All three callbacks receive a single argument.
Use vertical orientation for sidebar-style navigation. The pill animation, glow, and responsive scaling all work identically in vertical mode.