Navbar
Overview
The Navbar component implements Bulma's powerful, responsive navigation bar for your Bulma React UI.
It supports color, transparency, fixed positioning, dropdowns, and granular composition with subcomponents for brand, menu, items, burger (mobile toggle), start/end, and rich dropdowns. Use it for main navigation, site branding, and complex menu layouts.
Compose your navigation using Navbar, Navbar.Brand, Navbar.Burger, Navbar.Menu, Navbar.Start, Navbar.End, Navbar.Item, Navbar.Dropdown, and more for full Bulma flexibility.
Import
import { Navbar } from '@allxsmith/bestax-bulma';
Usage
Complete Navbar with Burger and Menu
This example demonstrates a fully responsive navigation bar using Navbar and its subcomponents. The Navbar.Burger toggles the mobile menu, while Navbar.Brand displays branding or a logo. Use the active prop on Navbar.Burger and Navbar.Menu to control the open state. Compose navigation links and dropdowns within Navbar.Start and Navbar.End for flexible layouts. Customize with the color, bgColor, fixed, transparent, isSpaced and hasShadow props as needed.
function example() { const [active, setActive] = useState(false); return ( <Navbar> <Navbar.Brand> <Navbar.Item href="#"> <img src="/img/logo.svg" alt="Logo" width="28" height="28" /> </Navbar.Item> <Navbar.Burger active={active} onClick={() => setActive(a => !a)} aria-label="menu" aria-expanded={active} /> </Navbar.Brand> <Navbar.Menu active={active}> <Navbar.Start> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#">Docs</Navbar.Item> <Navbar.Item href="#">About</Navbar.Item> <Navbar.Item href="#">Contact</Navbar.Item> </Navbar.Start> <Navbar.End> <Navbar.Item href="#">Login</Navbar.Item> </Navbar.End> </Navbar.Menu> </Navbar> ); }
Brand Only
This example shows a simple navbar with just the brand logo. The Navbar.Brand component is used to contain the logo image, which links to the homepage or main section of the site.
<Navbar> <Navbar.Brand> <Navbar.Item href="#"> <img src="/img/logo.svg" alt="Logo" width="28" height="28" /> </Navbar.Item> </Navbar.Brand> </Navbar>
Burger Only
Demonstrates the Navbar.Burger component, which is the mobile menu toggle. It doesn't have an associated menu in this snippet, but in practice, it would control the visibility of the Navbar.Menu.
The burger is only shown on touch/mobile viewports by default. The example below forces display: flex so you can see it on desktop.
<Navbar> <Navbar.Burger aria-label="menu" aria-expanded={false} style={{ display: 'flex' }} /> </Navbar>
Burger Active
Shows the Navbar.Burger in its active state, indicating that the menu it controls is open. The active prop is used to toggle this state.
<Navbar> <Navbar.Burger active aria-label="menu" aria-expanded style={{ display: 'flex' }} /> </Navbar>
Menu with Start and End
This example illustrates a Navbar.Menu with Navbar.Start and Navbar.End sections. The start section could contain primary navigation links, while the end section might hold user account links like login or profile.
<Navbar> <Navbar.Menu active> <Navbar.Start> <Navbar.Item href="#">Home</Navbar.Item> </Navbar.Start> <Navbar.End> <Navbar.Item href="#">Login</Navbar.Item> </Navbar.End> </Navbar.Menu> </Navbar>
Navigation Links and Dropdowns
A more complex example with navigation links and a dropdown menu. The dropdown is used for additional links or actions related to the main navigation items.
<Navbar> <Navbar.Brand> <Navbar.Item href="#"> <img src="/img/logo.svg" alt="Logo" width="28" height="28" /> </Navbar.Item> </Navbar.Brand> <Navbar.Menu active> <Navbar.Start> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#">Docs</Navbar.Item> <Navbar.Dropdown hoverable> <Navbar.Link>More</Navbar.Link> <Navbar.DropdownMenu> <Navbar.Item href="#">About</Navbar.Item> <Navbar.Item href="#">Jobs</Navbar.Item> <Navbar.Item href="#">Contact</Navbar.Item> <Navbar.Divider /> <Navbar.Item href="#">Report an issue</Navbar.Item> </Navbar.DropdownMenu> </Navbar.Dropdown> </Navbar.Start> </Navbar.Menu> </Navbar>
Custom Link Component
Use the as prop on Navbar.Item to render a custom link component, such as a router link. Its props follow as, so props like to are forwarded to the link component and are checked against that component's own types, no cast needed. See the Routing guide for the full patterns. The stand-in below renders to as the href, as a router's link does, so each item is a real link, and passes the item's class on.
// import { Link } from 'react-router-dom'; function example() { const Link = ({ to, ...rest }: { to: string } & React.AnchorHTMLAttributes<HTMLAnchorElement>) => ( <a {...rest} href={to} /> ); return ( <Navbar> <Navbar.Menu active> <Navbar.Start> <Navbar.Item as={Link} to="#home"> Home </Navbar.Item> <Navbar.Item as={Link} to="#pricing"> Pricing </Navbar.Item> </Navbar.Start> </Navbar.Menu> </Navbar> ); }
Transparent Navbar
Example of a navbar with a transparent background. This is often used for navbars that overlay content, like images or videos, giving a more integrated look.
<Navbar transparent>{/* ...brand and menu... */}</Navbar>
Spaced Navbar
The isSpaced prop renders Bulma's is-spaced: padding around the navbar, rounded items, and boxed dropdowns. Bulma applies it from the desktop breakpoint up, so on a narrower screen the navbar looks the same with or without it. From desktop up a spaced navbar with fixed="top" is taller than has-navbar-fixed-top pads the page for. Bulma's has-spaced-navbar-fixed-top is meant to pad it for the taller navbar, but it reads --bulma-navbar-padding-vertical, which Bulma sets on the navbar only, so on <html> it sets the page's padding to 0 and takes away has-navbar-fixed-top's. Register the variable on :root, with the padding your navbar uses, to make it work beside has-navbar-fixed-top, or pad the page yourself (the -bottom pair with fixed="bottom"). Bulma sets the navbar's own padding on .navbar, so a value on :root doesn't change the navbar, only the room made for it:
:root {
--bulma-navbar-padding-vertical: 1rem; /* Bulma's default */
}
<Navbar isSpaced> <Navbar.Brand> <Navbar.Item href="#"> <img src="/img/logo.svg" alt="Logo" width="28" height="28" /> </Navbar.Item> </Navbar.Brand> <Navbar.Menu active> <Navbar.Start> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#">Docs</Navbar.Item> <Navbar.Dropdown hoverable> <Navbar.Link>More</Navbar.Link> <Navbar.DropdownMenu> <Navbar.Item href="#">About</Navbar.Item> <Navbar.Item href="#">Contact</Navbar.Item> </Navbar.DropdownMenu> </Navbar.Dropdown> </Navbar.Start> </Navbar.Menu> </Navbar>
Navbar with a Shadow
The hasShadow prop renders Bulma's has-shadow, a thin shadow below the navbar that sets it off from the page. With fixed="bottom" the shadow sits above it instead. It's off unless you set it, because Bulma's navbar has no shadow of its own, while Box and Card take a hasShadow that's on by default.
<Navbar hasShadow> <Navbar.Brand> <Navbar.Item href="#"> <img src="/img/logo.svg" alt="Logo" width="28" height="28" /> </Navbar.Item> </Navbar.Brand> <Navbar.Menu active> <Navbar.Start> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#">Docs</Navbar.Item> </Navbar.Start> </Navbar.Menu> </Navbar>
Fixed Navbar
Shows the navbar fixed to the top of the viewport. This is useful for keeping the navigation accessible at all times as the user scrolls.
<Navbar fixed="top">{/* ...brand and menu... */}</Navbar>
Dropdown Right
Demonstrates a dropdown menu aligned to the right. This can be useful for user account menus, notifications, or other contextual actions.
<Navbar> <Navbar.Menu active> <Navbar.End> <Navbar.Dropdown hoverable right> <Navbar.Link>Right Dropdown</Navbar.Link> <Navbar.DropdownMenu right> <Navbar.Item href="#">Profile</Navbar.Item> <Navbar.Item href="#">Settings</Navbar.Item> </Navbar.DropdownMenu> </Navbar.Dropdown> </Navbar.End> </Navbar.Menu> </Navbar>
Dropup
This example shows a dropdown menu that opens upwards, which can be useful in certain layout situations to prevent covering content. A Hero is placed above the navbar to give the dropup room to expand.
<> <Hero color="primary" size="small"> <Hero.Body> <Title>Hero above Navbar</Title> <SubTitle>Hover "Dropup" below to see the menu open upward</SubTitle> </Hero.Body> </Hero> <Navbar> <Navbar.Menu active> <Navbar.Start> <Navbar.Dropdown hoverable up> <Navbar.Link>Dropup</Navbar.Link> <Navbar.DropdownMenu up> <Navbar.Item href="#">Up1</Navbar.Item> <Navbar.Item href="#">Up2</Navbar.Item> </Navbar.DropdownMenu> </Navbar.Dropdown> </Navbar.Start> </Navbar.Menu> </Navbar> </>
Dropdown without Arrow
Demonstrates a dropdown menu styled without the default arrow indicator. Set arrowless on Navbar.Link to remove the arrow indicator.
<Navbar> <Navbar.Menu active> <Navbar.Start> <Navbar.Dropdown hoverable> <Navbar.Link arrowless>No Arrow</Navbar.Link> <Navbar.DropdownMenu> <Navbar.Item href="#">A</Navbar.Item> <Navbar.Item href="#">B</Navbar.Item> </Navbar.DropdownMenu> </Navbar.Dropdown> </Navbar.Start> </Navbar.Menu> </Navbar>
Active Dropdown Item
Shows a dropdown menu with an active item. The active state is typically used to indicate the currently selected or active page/section.
<Navbar> <Navbar.Menu active> <Navbar.Start> <Navbar.Dropdown active> <Navbar.Link>Active Dropdown</Navbar.Link> <Navbar.DropdownMenu> <Navbar.Item href="#" active> A1 </Navbar.Item> <Navbar.Item href="#">A2</Navbar.Item> </Navbar.DropdownMenu> </Navbar.Dropdown> </Navbar.Start> </Navbar.Menu> </Navbar>
Dropdown with Divider
This example shows a dropdown menu that includes a divider, which is used to separate groups of items within the menu for better organization and readability.
<Navbar> <Navbar.Menu active> <Navbar.Start> <Navbar.Dropdown hoverable> <Navbar.Link>With Divider</Navbar.Link> <Navbar.DropdownMenu> <Navbar.Item href="#">One</Navbar.Item> <Navbar.Item href="#">Two</Navbar.Item> <Navbar.Divider /> <Navbar.Item href="#">Three</Navbar.Item> </Navbar.DropdownMenu> </Navbar.Dropdown> </Navbar.Start> </Navbar.Menu> </Navbar>
Color Modifiers
Demonstrates the use of different color modifiers for the navbar. Each Navbar component has a different color prop to showcase the available options.
function example() { const colors = [ 'primary', 'link', 'info', 'success', 'warning', 'danger', 'black', 'dark', 'light', 'white', ] as const; return ( <> {colors.map(color => ( <Navbar key={color} color={color} mb="2"> <Navbar.Brand> <Navbar.Item href="#"> <img src="/img/logo.svg" alt="Logo" width="28" height="28" /> </Navbar.Item> </Navbar.Brand> <Navbar.Menu active> <Navbar.Start> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#">Docs</Navbar.Item> <Navbar.Item href="#">Components</Navbar.Item> </Navbar.Start> </Navbar.Menu> </Navbar> ))} </> ); }
Forwarded ref
Navbar forwards a ref to the root <nav>, and Navbar.Burger, Navbar.Item, Navbar.Link and Navbar.Dropdown forward to their own elements — the burger <button>, the element as renders for both Navbar.Item and Navbar.Link, and the dropdown container.
function example() { const navRef = React.useRef<HTMLElement>(null); const [height, setHeight] = React.useState<number>(); return ( <> <Navbar ref={navRef}> <Navbar.Brand> <Navbar.Item href="#">Home</Navbar.Item> </Navbar.Brand> </Navbar> <Button mt="3" onClick={() => setHeight(navRef.current?.offsetHeight)}> Measure the navbar </Button> <p>Height: {height == null ? '—' : `${height}px`}</p> </> ); }
Navbar.Burger is hidden above the desktop breakpoint by Bulma, so read its node through the ref rather than trying to focus it when the viewport is wide.
Compound (dot-notation) usage
NavbarBrand, NavbarMenu, NavbarItem, and the other subcomponents are also available as Navbar.Brand, Navbar.Menu, Navbar.Item, and so on, so a complete navbar can be composed from the single Navbar import.
<Navbar> <Navbar.Brand> <Navbar.Item href="#"> <img src="/img/logo.svg" alt="Logo" width="28" height="28" /> </Navbar.Item> <Navbar.Burger aria-label="menu" /> </Navbar.Brand> <Navbar.Menu active> <Navbar.Start> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#">Docs</Navbar.Item> </Navbar.Start> <Navbar.End> <Navbar.Item href="#">Log in</Navbar.Item> </Navbar.End> </Navbar.Menu> </Navbar>
Accessibility
- The root
Navbarrenders as<nav role="navigation" aria-label="main navigation">. The default accessible name ismain navigation. A screen reader announces it with the role, and since the name holds the role word, "navigation" is heard twice. Pass a name without the role word (aria-label="Site"), and a different name on each Navbar when a page has more than one. A passedaria-labelreplaces the default. Navbar.Item activesetsaria-current="page"on the elementasrenders, the link by default, so the current item isn't only a color. Anaria-currentyou pass wins: a navbar of sections on one page can say"location", andaria-current={false}turns it off.- Bulma fills an active link item with its selected color, the link color in a navbar with no
color, and bestax's styles give its text the color Bulma picks to read on that fill,--bulma-navbar-item-selected-color-l. Bulma's own stylesheet leaves the text in the navbar's normal text color, dark gray on blue on the light scheme, so the rule ships inbestax.cssandextras.css. A--bulma-navbar-item-coloryou set on the item itself still wins, and an item with abgColorkeeps the navbar's text color. A rule of your own that takes the fill off restatescolortoo. - Use semantic links (
<a>) and buttons, and provide cleararia-labelandaria-expandedfor the burger toggle. Navbar.Linkinside aNavbar.Dropdownautomatically getsaria-haspopup="true"andaria-expandedsynced to the dropdown's open state — no manual wiring required. Enter/Space toggle the dropdown open/closed, and Escape closes it and keeps focus on the link. Escape anywhere else in the open dropdown, its menu included, puts focus back on the link and closes it too, unless a control there marks the key used, the key comes from a dialog or from content opened from the menu into a portal, or focus can't go back to the link. Focus landing outside an open dropdown, as Tab past its last item or Shift+Tab back past its link does, closes it too, so its menu isn't left over the page. A controlled one is told throughonActiveChangeand keeps itsactive. Focus moving into content opened from the menu into a portal or into a dialog markedaria-modal, such as aModalan item opens, which gives focus back to the item when it closes, focus going nowhere, as the window losing focus does, and a press outside that doesn't move focus leave it open. When the trigger isn't interactive on its own — nohref, notas="button", and not a custom component — it also getsrole="button"andtabIndex={0}so it's reachable and operable by keyboard, and a mouse/touch click on it toggles the dropdown too (a caller-suppliedonClickstill runs, and canpreventDefault()to opt out).- A custom component passed to
askeeps its own semantics, because a router link takestorather thanhrefand so can't be recognised from the props it's given. If yours renders something non-interactive instead, passrole="button"and it takes the fallback above —tabIndexand click included. The keyboard path is wired either way. hoverabledropdowns keep working with a mouse (hover-to-open); the keyboard path above opens and closes them independently of hover. Bulma shows ahoverabledropdown's menu while the pointer is on it and while focus is in it, the link included, on a desktop-wide window. Escape puts a menu shown that way away, and it stays away until the pointer has left the dropdown and focus has too, or until the pointer comes back or focus moves onto something in it. From the page, the key goes on to what has focus; from inside the dropdown, focus moves to the link, with the same exceptions as for an open one, such as focus that can't go back to the link, where the menu stays. Below the desktop breakpoint, where the menu always shows under the burger, Escape doesn't put it away, though it still closes an open one.- A fixed navbar: with
fixed="top", bestax's styles pad the page's scroll by--bulma-navbar-height, so the browser scrolls a control that takes focus, or an in-page link's target, to below the navbar rather than under it.fixed="bottom"pads the bottom of the page the same way, and a navbar fixed by Bulma'sis-fixed-top-touchor-desktopclasses (or the bottom pair) in itsclassNamegets the same at that breakpoint, as it gets the margins that keep it over the page while an overlay locks its scrolling. From the desktop breakpoint up, a spaced navbar pads by its taller height, with--bulma-navbar-padding-verticalabove and below (Bulma's1remunless you register the variable on:rootwith your navbar's padding). The page's own padding, so its top doesn't start under the navbar, is still Bulma'shas-navbar-fixed-topon<html>, orhas-navbar-fixed-top-touchor-desktopfor a navbar fixed at one breakpoint. Ascroll-padding-topof your own on<html>, or anAppFrame's, wins over it: set yours for a navbar taller than the height it pads by, or to0where your anchor targets already carry ascroll-margin-top, which adds to it. This ships inbestax.cssandextras.css, not in Bulma's own stylesheet. - Forced colors: Bulma draws the burger's bars as a background color, which forced colors
(Windows' contrast themes) replaces, so the burger would vanish there while it still works and
takes focus. bestax's styles keep its bars visible in the system's button text color. That rule
ships in
bestax.cssandextras.css, not in Bulma's own stylesheet, and anAppFrame's burger gets it too. Bulma marks an active or selected link item,Navbar.Linkand dropdown row with a fill and a text color alone, which forced colors replaces, so bestax's styles draw a bar in the system's highlight color inside it there: along its bottom in a row, and down its start edge where the items stack, in a dropdown and in the menu the burger opens. The item and everything in it stay in the contrast theme's colors, and an active tab gets the bar above Bulma's thicker underline. This ships in the same stylesheets. Navbar.Dividerin forced colors: Bulma draws it as a background color too, which forced colors paints in the dropdown's own color, so the line would vanish. bestax's styles draw it in the system's text color there, from the same stylesheets.- An open dropdown's edge in forced colors: from the desktop breakpoint up, Bulma draws
Navbar.DropdownMenuas a box over the page, edged with a shadow and, for some, a line on the side it opens from. Forced colors drops the shadow and paints the box in the page's own color, so bestax's styles draw a one pixel line in the system's text color around it there, outside the box, so nothing moves. Under the burger its rows sit in the menu, with no box to edge. This ships in the same stylesheets. - In a colored
Hero: Bulma's hero sets the colors its navbar's items take on hover and when active, but Bulma's navbar doesn't read them, so a focused or hovered item took the scheme's fill under the hero's text, and the active item and the burger took the link color. For aNavbarwith nocolorof its own, bestax's styles draw a focused, hovered or active item in the hero's text color with the hero's background color as its text, the burger and a tab in the hero's text color, and the dropdown arrow in its link's text color. The menu the burger opens, and the dropdown's rows in it, take the hero's background and text, except an active row, which keeps Bulma's selected fill and the text that reads on it, and on a phone a bold hero's menu takes the hero's own gradient. WhereNavbar.DropdownMenuis a box of its own, on a desktop, its links keep Bulma's colors. That rule ships inbestax.cssandextras.css, not in Bulma's own stylesheet.
There's no arrow-key roving between navbar items, and a press outside an open Navbar.Dropdown
closes it only when it moves focus there. A press on a field moves focus in every browser, and
one on a button or a link does in some, such as Chrome, and not in others, such as Safari. Bulma navbar dropdowns are hover/click surfaces, so this is
intentionally kept simple.
Related Components
Button: For actions in Navbar.Icon: For icons inside Navbar items.- Helper Props: Bulma helper props for spacing and other utilities.
Additional Resources
You can use Bulma helper props with <Navbar /> and its subcomponents, except Navbar.Dropdown, Navbar.DropdownMenu and Navbar.Divider, for powerful utility-based styling.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes for the navbar. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color for the navbar. |
color | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | 'black' | 'dark' | 'light' | 'white' | — | Bulma color modifier for the navbar. |
bgColor | Bulma color | 'inherit' | 'current' | — | Background color for the navbar. |
transparent | boolean | false | Renders the navbar with a transparent background. |
isSpaced | boolean | false | Renders Bulma's is-spaced: padding around the navbar, rounded items and boxed dropdowns. Bulma applies it from the desktop breakpoint up, so below that the navbar looks the same either way. From desktop up a spaced navbar with fixed="top" is taller than has-navbar-fixed-top pads the page for. Bulma's has-spaced-navbar-fixed-top is meant to pad it for the taller navbar, but it reads --bulma-navbar-padding-vertical, which Bulma sets on the navbar only, so on <html> it sets the page's padding to 0 and takes away has-navbar-fixed-top's. Register that variable on :root with the padding the navbar uses (Bulma's default is 1rem) to make it work beside has-navbar-fixed-top, or pad the page yourself; the same goes for the -bottom pair with fixed="bottom". |
hasShadow | boolean | false | Renders Bulma's has-shadow: a shadow below the navbar, or above it with fixed="bottom". Off unless set, since Bulma's navbar has no shadow of its own. Box and Card take a hasShadow that defaults to true instead, because Bulma gives those a shadow already. |
fixed | 'top' | 'bottom' | — | Fixes the navbar to the top or bottom of the viewport. |
children | React.ReactNode | — | Navbar content (compose with subcomponents). |
aria-label | React.AriaAttributes['aria-label'] | 'main navigation' | Accessible name. Defaults to main navigation. A screen reader announces it with the landmark's role, and since the name holds the role word, "navigation" is heard twice. Pass a name without it (aria-label="Site"), and a different name on each Navbar when a page has more than one. A passed aria-label replaces the default, and aria-label={undefined} removes it, leaving the landmark unnamed. |
ref | React.Ref<HTMLElement> | — | Ref forwarded to the root <nav> element. |
... | All standard HTML attributes and Bulma helper props | — | See Helper Props |
Subcomponents:
Navbar.Brand: For logo and branding (left side)Navbar.Item: Navigation links, buttons, or custom contentNavbar.Link: Dropdown trigger with arrow indicator (use as first child ofNavbar.Dropdown)Navbar.Burger: Responsive menu toggle (mobile)Navbar.Menu: Collapsible content (containsNavbar.StartandNavbar.End)Navbar.Start: Left-aligned menu areaNavbar.End: Right-aligned menu areaNavbar.Dropdown: Dropdown parent (with options for hover, up, right, active)Navbar.DropdownMenu: Dropdown menu containerNavbar.Divider: Divider in dropdown menus.
Navbar.Brand
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color for the brand. |
color | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | — | Renders has-text-<color>, exactly like textColor. Bulma has no .navbar-brand.is-<color> rule, so this is not a filled variant. textColor takes precedence when both are set, and is the one that reaches the full color list. |
children | React.ReactNode | — | Brand content. |
... | All standard <div> attributes and Bulma helper props | — | See Helper Props |
Navbar.Item
| Prop | Type | Default | Description |
|---|---|---|---|
as | React.ElementType | 'a' | Render as another intrinsic element ('span', 'div', 'button') or a custom component (e.g. a router link). Defaults to 'a'. 'button' renders type="button", so an item inside a form does not submit it. Pass type="submit" or type="reset" and yours is used; any other value, or a spread carrying type: undefined, renders type="button". |
className | string | — | Additional CSS classes. |
active | boolean | false | Marks the item as the current one. It adds Bulma's is-active class, and aria-current="page" on the element as renders, so assistive tech can tell which item is current too. An aria-current you pass wins, even undefined: use it to say something else ("location" for a section of one page, say), or aria-current={false} to turn it off. An active item that isn't navigation takes aria-current={false}: an as="button" control, say, or a has-dropdown container like the <Navbar.Item as="div" className="has-dropdown" active> older bestax-migrate versions wrote. That one can be a Navbar.Dropdown instead. Bulma fills an active link item with its selected color, the link color in a navbar with no color. bestax's stylesheets give the text that color's invert, where Bulma's own leaves it in the navbar's text color, dark gray on blue on the light scheme. With a bgColor the text keeps the navbar's color, and a fill of your own from CSS wants a textColor too. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color for the item. |
bgColor | Bulma color | 'inherit' | 'current' | — | Background color for the item. |
children | React.ReactNode | — | Navbar item content. |
ref | PolymorphicRef<React.ElementType> | — | Ref forwarded to the element as renders, typed from as: the DOM node for an intrinsic tag, or whatever handle a custom component exposes. |
... | Remaining props of the element or component selected by as (default <a>) and Bulma helper props | — | See Helper Props |
Navbar.Link
| Prop | Type | Default | Description |
|---|---|---|---|
as | React.ElementType | 'a' | Render as another intrinsic element ('button', 'span') or a custom component. Defaults to 'a'. Inside a Navbar.Dropdown this also decides the trigger's semantics. A custom component is taken to be interactive already — a router link, typically — so it keeps its own role and click behaviour. An intrinsic tag is judged on what it is: 'button', or anything carrying an href, is left alone, and everything else ('span', a bare 'a', a custom element) gets role="button", tabIndex and a click that opens the dropdown. If your custom component renders something non-interactive, pass role="button" and it takes that fallback too — tabIndex and click included. The keyboard path is attached either way. 'button' renders type="button", so a link inside a form does not submit it. Pass type="submit" or type="reset" and yours is used; any other value, or a spread carrying type: undefined, renders type="button". |
className | string | — | Additional CSS classes. |
arrowless | boolean | false | Remove the dropdown arrow indicator. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color. |
bgColor | Bulma color | 'inherit' | 'current' | — | Background color. |
children | React.ReactNode | — | Link content. |
ref | PolymorphicRef<React.ElementType> | — | Ref forwarded to the element as renders, typed from as: the DOM node for an intrinsic tag, or whatever handle a custom component exposes. |
... | Remaining props of the element or component selected by as (default <a>) and Bulma helper props | — | See Helper Props |
Navbar.Burger
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color for the burger. |
color | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | — | Renders has-text-<color>, exactly like textColor. Bulma has no .navbar-burger.is-<color> rule, so this is not a filled variant. textColor takes precedence when both are set, and is the one that reaches the full color list. |
active | boolean | false | Whether the burger is active. |
children | React.ReactNode | — | Custom content inside the burger, rendered after its four bar spans. Bulma styles every <span> in the burger as a bar, so an extra span here draws an extra bar. |
aria-label | React.AriaAttributes['aria-label'] | 'menu' | Accessible name. Pass your own to replace it. An empty one, or a spread carrying 'aria-label': undefined, keeps the default rather than leaving the button unnamed. |
aria-expanded | boolean | null | active | Expanded state for assistive technology. It follows active unless you pass true or false, and null leaves it off, for a burger whose state isn't known yet; a spread carrying 'aria-expanded': undefined still follows active. |
onClick | React.MouseEventHandler<HTMLButtonElement> | — | Click handler. |
ref | React.Ref<HTMLButtonElement> | — | Ref forwarded to the burger button element. |
type | 'button' | 'submit' | 'reset' | 'button' | Button type. Defaults to 'button', so a burger inside a form does not submit it. Pass 'submit' or 'reset' and yours is used; any other value, or a spread carrying type: undefined, renders 'button'. |
... | All standard <button> attributes and Bulma helper props | — | See Helper Props |
Navbar.Menu
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color for the menu. |
color | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | — | Renders has-text-<color>, exactly like textColor. Bulma has no .navbar-menu.is-<color> rule, so this is not a filled variant. textColor takes precedence when both are set, and is the one that reaches the full color list. |
active | boolean | false | Whether the menu is active. |
children | React.ReactNode | — | Menu content. |
... | All standard <div> attributes and Bulma helper props | — | See Helper Props |
Navbar.Start
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color. |
color | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | — | Renders has-text-<color>, exactly like textColor. Bulma has no is-<color> rule for this area, so this is not a filled variant. textColor takes precedence when both are set, and is the one that reaches the full color list. |
children | React.ReactNode | — | Content. |
... | All standard <div> attributes and Bulma helper props | — | See Helper Props |
Navbar.End
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
textColor | Bulma color | 'inherit' | 'current' | — | Text color. |
color | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | — | Renders has-text-<color>, exactly like textColor. Bulma has no is-<color> rule for this area, so this is not a filled variant. textColor takes precedence when both are set, and is the one that reaches the full color list. |
children | React.ReactNode | — | Content. |
... | All standard <div> attributes and Bulma helper props | — | See Helper Props |
Navbar.Dropdown
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
right | boolean | false | Dropdown aligned right. |
up | boolean | false | Dropdown opens upwards. |
hoverable | boolean | false | Dropdown opens on hover, and while focus is in it, as Bulma's navbar shows it on a desktop-wide window. Escape puts away a menu the pointer or focus is showing there, and it stays away until the pointer has left the dropdown and focus has too, or until the pointer comes back or focus moves onto something in it. Escape from inside the dropdown puts focus on its Navbar.Link first, and leaves the menu as it is in the cases active lists, such as when focus can't go back to the link. |
active | boolean | false | Dropdown is open, whether you control it or not. Escape on its Navbar.Link, or anywhere else in the open dropdown, closes it and puts focus on the link, unless a control there marks the key used, the key comes from a dialog or from content opened from the menu into a portal, or focus can't go back to the link. Focus landing outside the dropdown, as Tab past its last item does, closes it too, and one you control is told through onActiveChange and keeps its prop. Focus moving into content opened from the menu into a portal or into a dialog marked aria-modal it isn't in, focus going nowhere, as a window losing focus does, and a press outside that doesn't move focus leave it open. |
onActiveChange | (active: boolean) => void | — | Callback when dropdown active state changes. |
children | React.ReactNode | — | Dropdown content. |
ref | React.Ref<HTMLDivElement> | — | Ref forwarded to the dropdown container element. |
... | All standard <div> attributes | — |
Navbar.DropdownMenu
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes. |
right | boolean | false | Dropdown aligned right. |
up | boolean | false | Dropdown opens upwards. |
children | React.ReactNode | — | Dropdown menu content. |
... | All standard <div> attributes | — |
CSS & Sass Variables
Navbar registers these variables on its own .navbar element. Override them there (or via className) — a value set on an ancestor is only inherited, and loses to the component-level declaration. See Theme.
| CSS Variable | Sass Variable | Default |
|---|---|---|
--bulma-navbar-height § | $navbar-height | 3.25rem |
--bulma-navbar-h | $navbar-h | var(--bulma-scheme-h) |
--bulma-navbar-s | $navbar-s | var(--bulma-scheme-s) |
--bulma-navbar-l | $navbar-l | var(--bulma-scheme-main-l) |
--bulma-navbar-background-color | $navbar-background-color | var(--bulma-scheme-main) |
--bulma-navbar-box-shadow-size | $navbar-box-shadow-size | 0 0.125em 0 0 |
--bulma-navbar-box-shadow-color | $navbar-box-shadow-color | var(--bulma-background) |
--bulma-navbar-padding-vertical | $navbar-padding-vertical | 1rem |
--bulma-navbar-padding-horizontal | $navbar-padding-horizontal | 2rem |
--bulma-navbar-z | $navbar-z | 30 |
--bulma-navbar-fixed-z | $navbar-fixed-z | 30 |
--bulma-navbar-item-background-a | $navbar-item-background-a | 0 |
--bulma-navbar-item-background-l | $navbar-item-background-l | var(--bulma-scheme-main-l) |
--bulma-navbar-item-background-l-delta | $navbar-item-background-l-delta | 0% |
--bulma-navbar-item-hover-background-l-delta | $navbar-item-hover-background-l-delta | var(--bulma-hover-background-l-delta) |
--bulma-navbar-item-active-background-l-delta | $navbar-item-active-background-l-delta | var(--bulma-active-background-l-delta) |
--bulma-navbar-item-color-l | $navbar-item-color-l | var(--bulma-text-l) |
--bulma-navbar-item-color | $navbar-item-color | hsl(var(--bulma-navbar-h), var(--bulma-navbar-s), var(--bulma-navbar-item-color-l)) |
--bulma-navbar-item-selected-h | $navbar-item-selected-h | var(--bulma-link-h) |
--bulma-navbar-item-selected-s | $navbar-item-selected-s | var(--bulma-link-s) |
--bulma-navbar-item-selected-l | $navbar-item-selected-l | var(--bulma-link-l) |
--bulma-navbar-item-selected-background-l | $navbar-item-selected-background-l | var(--bulma-link-l) |
--bulma-navbar-item-selected-color-l | $navbar-item-selected-color-l | var(--bulma-link-invert-l) |
--bulma-navbar-item-img-max-height | $navbar-item-img-max-height | 1.75rem |
--bulma-navbar-burger-color | $navbar-burger-color | var(--bulma-link) |
--bulma-navbar-tab-hover-background-color | $navbar-tab-hover-background-color | transparent |
--bulma-navbar-tab-hover-border-bottom-color | $navbar-tab-hover-border-bottom-color | var(--bulma-link) |
--bulma-navbar-tab-active-color | $navbar-tab-active-color | var(--bulma-link) |
--bulma-navbar-tab-active-background-color | $navbar-tab-active-background-color | transparent |
--bulma-navbar-tab-active-border-bottom-color | $navbar-tab-active-border-bottom-color | var(--bulma-link) |
--bulma-navbar-tab-active-border-bottom-style | $navbar-tab-active-border-bottom-style | solid |
--bulma-navbar-tab-active-border-bottom-width | $navbar-tab-active-border-bottom-width | 0.1875em |
--bulma-navbar-dropdown-background-color | $navbar-dropdown-background-color | var(--bulma-scheme-main) |
--bulma-navbar-dropdown-border-l | $navbar-dropdown-border-l | var(--bulma-border-l) |
--bulma-navbar-dropdown-border-color | $navbar-dropdown-border-color | hsl(var(--bulma-navbar-h), var(--bulma-navbar-s), var(--bulma-navbar-dropdown-border-l)) |
--bulma-navbar-dropdown-border-style | $navbar-dropdown-border-style | solid |
--bulma-navbar-dropdown-border-width | $navbar-dropdown-border-width | 0.125em |
--bulma-navbar-dropdown-offset | $navbar-dropdown-offset | -0.25em |
--bulma-navbar-dropdown-arrow | $navbar-dropdown-arrow | var(--bulma-link) |
--bulma-navbar-dropdown-radius | $navbar-dropdown-radius | var(--bulma-radius-large) |
--bulma-navbar-dropdown-z | $navbar-dropdown-z | 20 |
--bulma-navbar-dropdown-boxed-radius | $navbar-dropdown-boxed-radius | var(--bulma-radius-large) |
--bulma-navbar-dropdown-boxed-shadow | $navbar-dropdown-boxed-shadow | 0 0.5em 0.5em hsla(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-invert-l), 0.1), 0 0 0 1px hsla(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-invert-l), 0.1) |
--bulma-navbar-dropdown-item-h | $navbar-dropdown-item-h | var(--bulma-scheme-h) |
--bulma-navbar-dropdown-item-s | $navbar-dropdown-item-s | var(--bulma-scheme-s) |
--bulma-navbar-dropdown-item-l | $navbar-dropdown-item-l | var(--bulma-scheme-main-l) |
--bulma-navbar-dropdown-item-background-l | $navbar-dropdown-item-background-l | var(--bulma-scheme-main-l) |
--bulma-navbar-dropdown-item-color-l | $navbar-dropdown-item-color-l | var(--bulma-text-l) |
--bulma-navbar-divider-background-l | $navbar-divider-background-l | var(--bulma-background-l) |
--bulma-navbar-divider-height | $navbar-divider-height | 0.125em |
--bulma-navbar-bottom-box-shadow-size | $navbar-bottom-box-shadow-size | 0 -0.125em 0 0 |
§ declared globally, on :root, rather than on the element: set it on the element itself (via className/style) or on any ancestor, up to :root to retheme every instance.