Skip to main content

Tabs

Overview​

The Tabs component provides flexible and fully-featured Bulma tab navigation for your Bulma React UI.

It supports alignment, size, boxed and toggle styles, rounded and fullwidth options, and can display icons or custom content in each tab. Build tabbed panels from Tabs.Tab and Tabs.Content, which keep the selected tab, show its panel and handle the keyboard, or build Bulma navigation from Tabs.Items in a plain <ul>, with your own links inside. (The color prop is deprecated: Bulma ships no tabs color CSS, so it has never had a visual effect.)

info

Use Tabs for navigation, filtering, or switching between views. Combine with icons and Bulma helpers for advanced layouts.


Import​

import { Tabs } from '@allxsmith/bestax-bulma';

Usage​

Tab Panels​

Give each Tabs.Tab and Tabs.Content.Item the same index and Tabs shows the panel of the selected tab. Click a tab, or press Tab to reach the list, move between tabs with the arrow keys and press Enter or Space to open one. disabled keeps a tab from being picked, and the arrow keys skip it. See Accessibility for every key.

<Tabs>
  <Tabs.List>
    <Tabs.Tab index={0}>Inbox</Tabs.Tab>
    <Tabs.Tab index={1} disabled>
      Drafts
    </Tabs.Tab>
    <Tabs.Tab index={2}>Sent</Tabs.Tab>
    <Tabs.Tab index={3}>Archive</Tabs.Tab>
  </Tabs.List>
  <Tabs.Content>
    <Tabs.Content.Item index={0}>Messages waiting for you.</Tabs.Content.Item>
    <Tabs.Content.Item index={1}>Unfinished messages.</Tabs.Content.Item>
    <Tabs.Content.Item index={2}>Messages you have sent.</Tabs.Content.Item>
    <Tabs.Content.Item index={3}>
      Messages you have filed away.
    </Tabs.Content.Item>
  </Tabs.Content>
</Tabs>


Centered Alignment​

This example demonstrates a tab navigation with centered alignment using the align="centered" prop. Compose navigation tabs from Tabs.Items in a plain <ul>, each holding a link with an href. The active prop highlights the current tab with Bulma's is-active class and nothing more, so put aria-current="page" on its link too, which tells a screen reader the tab is the current page. Tabs.List is the tab list for Tabs.Tab, so it isn't used here. This layout is ideal for main navigation. To switch views in place, use Tabs.Tab with Tabs.Content, as in Tab Panels.

<Tabs align="centered">
  <ul>
    <Tabs.Item active>
      <a href="#home" aria-current="page">
        Home
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#profile">Profile</a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#settings">Settings</a>
    </Tabs.Item>
  </ul>
</Tabs>


Right Alignment​

This example shows how to align tabs to the right using the align="right" prop. The active prop and the link's aria-current="page" mark the current tab, and you can add as many Tabs.Item components as needed for your navigation structure.

<Tabs align="right">
  <ul>
    <Tabs.Item>
      <a href="#home">Home</a>
    </Tabs.Item>
    <Tabs.Item active>
      <a href="#profile" aria-current="page">
        Profile
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#settings">Settings</a>
    </Tabs.Item>
  </ul>
</Tabs>


With Icons​

This example demonstrates using icons in your tabs. Each tab can contain an icon and text, making your navigation more visually appealing and informative. The active tab is highlighted, and you can use any Font Awesome icons or your custom icons.

<Tabs>
  <ul>
    <Tabs.Item active>
      <a href="#pictures" aria-current="page">
        <Icon name="fas fa-image" size="small" aria-hidden="true" />
        <span>Pictures</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#music">
        <Icon name="fas fa-music" size="small" aria-hidden="true" />
        <span>Music</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#videos">
        <Icon name="fas fa-film" size="small" aria-hidden="true" />
        <span>Videos</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#documents">
        <Icon name="fas fa-file-alt" size="small" aria-hidden="true" />
        <span>Documents</span>
      </a>
    </Tabs.Item>
  </ul>
</Tabs>


Small, Medium, and Large Tabs​

Easily adjust the size of your tabs using the size prop. This example shows the three available sizes: small, medium, and large. Each size variation can be used to emphasize different levels of navigation or to fit different design requirements.

<>
  <Tabs size="small">
    <ul>
      <Tabs.Item active>
        <a href="#tab-1" aria-current="page">
          Tab 1
        </a>
      </Tabs.Item>
      <Tabs.Item>
        <a href="#tab-2">Tab 2</a>
      </Tabs.Item>
      <Tabs.Item>
        <a href="#tab-3">Tab 3</a>
      </Tabs.Item>
    </ul>
  </Tabs>

  <Tabs size="medium">
    <ul>
      <Tabs.Item active>
        <a href="#tab-1" aria-current="page">
          Tab 1
        </a>
      </Tabs.Item>
      <Tabs.Item>
        <a href="#tab-2">Tab 2</a>
      </Tabs.Item>
      <Tabs.Item>
        <a href="#tab-3">Tab 3</a>
      </Tabs.Item>
    </ul>
  </Tabs>

  <Tabs size="large">
    <ul>
      <Tabs.Item active>
        <a href="#tab-1" aria-current="page">
          Tab 1
        </a>
      </Tabs.Item>
      <Tabs.Item>
        <a href="#tab-2">Tab 2</a>
      </Tabs.Item>
      <Tabs.Item>
        <a href="#tab-3">Tab 3</a>
      </Tabs.Item>
    </ul>
  </Tabs>
</>


Boxed Tabs​

The boxed style gives your tabs a distinct, separated look. This example demonstrates how to create boxed tabs using the boxed prop. Boxed tabs are great for categorizing content or features distinctly.

<Tabs boxed>
  <ul>
    <Tabs.Item active>
      <a href="#introduction" aria-current="page">
        Introduction
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#elements">Elements</a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#components">Components</a>
    </Tabs.Item>
  </ul>
</Tabs>


Toggle Tabs​

Toggle tabs suit a few views or filters that each have their own address, such as all items, only active ones and only completed ones. This example shows how to create toggle tabs using the toggle prop. The active tab indicates the current filter or view.

<Tabs toggle>
  <ul>
    <Tabs.Item active>
      <a href="#all" aria-current="page">
        All
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#active">Active</a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#completed">Completed</a>
    </Tabs.Item>
  </ul>
</Tabs>


Toggle Rounded Tabs​

Combine the toggle style with rounded corners for a pill-like appearance. This example demonstrates toggle rounded tabs, which are especially useful in mobile interfaces or where a softer look is desired.

<Tabs toggle rounded>
  <ul>
    <Tabs.Item active>
      <a href="#all" aria-current="page">
        All
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#active">Active</a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#completed">Completed</a>
    </Tabs.Item>
  </ul>
</Tabs>


Fullwidth Tabs​

Make your tabs span the entire width of their container with the isFullwidth prop. This example shows fullwidth tabs, which are useful for emphasizing the tab navigation or when you have many tabs to display. (The older fullwidth spelling still works as a deprecated alias.)

<Tabs isFullwidth>
  <ul>
    <Tabs.Item active>
      <a href="#one" aria-current="page">
        One
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#two">Two</a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#three">Three</a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#four">Four</a>
    </Tabs.Item>
  </ul>
</Tabs>


Centered Boxed Tabs with Icons​

This example combines several features: centered alignment, boxed style, and icons. Such a combination is perfect for a dashboard or a complex application where you need to save space and still provide clear navigation.

<Tabs align="centered" boxed>
  <ul>
    <Tabs.Item active>
      <a href="#home" aria-current="page">
        <Icon name="fas fa-home" size="small" aria-hidden="true" />
        <span>Home</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#profile">
        <Icon name="fas fa-user" size="small" aria-hidden="true" />
        <span>Profile</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#settings">
        <Icon name="fas fa-cog" size="small" aria-hidden="true" />
        <span>Settings</span>
      </a>
    </Tabs.Item>
  </ul>
</Tabs>


Toggle Fullwidth Tabs with Icons​

Enhance your toggle tabs with icons for better visual communication. This example also uses the isFullwidth prop to make the tabs span the entire width, which is useful for mobile views or when you want to emphasize the tab bar.

<Tabs toggle isFullwidth>
  <ul>
    <Tabs.Item active>
      <a href="#list" aria-current="page">
        <Icon name="fas fa-list" size="small" aria-hidden="true" />
        <span>List</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#done">
        <Icon name="fas fa-check" size="small" aria-hidden="true" />
        <span>Done</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#removed">
        <Icon name="fas fa-times" size="small" aria-hidden="true" />
        <span>Removed</span>
      </a>
    </Tabs.Item>
  </ul>
</Tabs>


Centered Boxed Medium Tabs with Icons​

This example features centered, boxed tabs in medium size, each with an icon. It's a great layout for a feature-rich application where you want to provide quick access to important sections.

<Tabs align="centered" boxed size="medium">
  <ul>
    <Tabs.Item active>
      <a href="#favorites" aria-current="page">
        <Icon name="fas fa-star" size="small" aria-hidden="true" />
        <span>Favorites</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#recent">
        <Icon name="fas fa-clock" size="small" aria-hidden="true" />
        <span>Recent</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#archive">
        <Icon name="fas fa-archive" size="small" aria-hidden="true" />
        <span>Archive</span>
      </a>
    </Tabs.Item>
  </ul>
</Tabs>


Toggle Fullwidth Large Tabs with Icons​

The final example showcases toggle tabs with fullwidth and large size, including icons. This combination is powerful for applications with complex navigation needs, ensuring that users can easily understand and access different sections.

<Tabs toggle isFullwidth size="large">
  <ul>
    <Tabs.Item active>
      <a href="#launch" aria-current="page">
        <Icon name="fas fa-rocket" size="small" aria-hidden="true" />
        <span>Launch</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#alerts">
        <Icon name="fas fa-bell" size="small" aria-hidden="true" />
        <span>Alerts</span>
      </a>
    </Tabs.Item>
    <Tabs.Item>
      <a href="#settings">
        <Icon name="fas fa-cogs" size="small" aria-hidden="true" />
        <span>Settings</span>
      </a>
    </Tabs.Item>
  </ul>
</Tabs>


Compound (dot-notation) usage​

TabList, Tab, TabsContent, and TabContentItem are also available as Tabs.List, Tabs.Tab, Tabs.Content, and Tabs.Content.Item, so a complete tabbed interface can be composed from the single Tabs import.

<Tabs>
  <Tabs.List>
    <Tabs.Tab index={0}>Overview</Tabs.Tab>
    <Tabs.Tab index={1}>Settings</Tabs.Tab>
  </Tabs.List>
  <Tabs.Content>
    <Tabs.Content.Item index={0}>Overview panel</Tabs.Content.Item>
    <Tabs.Content.Item index={1}>Settings panel</Tabs.Content.Item>
  </Tabs.Content>
</Tabs>


Accessibility​

Tabs built from Tabs.Tab follow the WAI-ARIA tabs pattern, with manual activation.

KeyAction
Tab / Shift+TabEnter the tab list on the selected tab, or leave it from whichever tab has focus
→ / ←Move focus to the next / previous tab, wrapping at either end
↓ / ↑Move focus to the next / previous tab in a vertical tab list (→ and ← keep working there)
Home / EndMove focus to the first / last tab
Enter / SpaceActivate the focused tab: select it, show its panel and call onChange
  • The tab list is a single tab stop. While focus is in it, the stop follows focus, and once focus leaves it returns to the selected tab.
  • Activation is manual: moving focus with the arrow keys, Home or End doesn't change the panel or call onChange. Enter, Space and a click do. A key press activates the tab through a click on it, so click listeners see keyboard activation too.
  • The arrow keys, Home and End skip disabled tabs. A disabled tab is marked aria-disabled and never takes the tab stop. When the selected tab is disabled, or no tab matches value, the enabled tab with the lowest index takes it, so the list can still be reached.
  • Tabs.List is the tablist (marked aria-orientation="vertical" in a vertical layout), each Tabs.Tab is a tab with aria-selected, and each Tabs.Content.Item is a tabpanel. A tab names its panel in aria-controls and a panel names its tab in aria-labelledby, so the panel is announced with the tab's label. The ids are generated, and when you pass your own id to a tab or a panel, the other side follows it.
  • Panels aren't focusable themselves. When a panel holds nothing focusable, pass it tabIndex={0} so Tab moves from the tab list into it.
  • The focus ring shows for keyboard focus only, drawn inside the tab in Bulma's focus color, width and style (--bulma-focus-h, --bulma-focus-s, --bulma-focus-l, --bulma-focus-width, --bulma-focus-style). In a toggle row, a focused tab comes in front of the neighbors that overlap it, so none of them covers the ring's edge. A disabled tab is dimmed, with a not-allowed cursor and no hover. All of this comes from the bestax extras (extras.css, or bestax.css, which includes them), the same styles that show and hide the panels.
  • Forced colors: Bulma marks the active tab with colors alone, which forced colors (Windows' contrast themes) replaces, so bestax's styles draw a bar in the system's highlight color along the bottom of the active tab there, in every style, in a vertical layout and for a link in an active Tabs.Item. The tab and everything in it stay in the contrast theme's colors, and a disabled tab is drawn at full strength in the theme's color for something disabled, rather than dimmed. This comes from the bestax extras too.
  • On a right-to-left page a vertical layout mirrors: side="left" puts the tabs at the right, where the line starts, and side="right" at the left. The line between the tabs and the panel, and the selected tab's mark on it, stay on the side that faces the panel.
  • Built from Tabs.Items with links inside, as in most examples above, the tabs are Bulma navigation, and the keys, roles and disabled look above don't apply. Give each link an href, so a keyboard reaches it and a screen reader offers it as a link, and put aria-current="page" on the current tab's link: active adds only Bulma's is-active class, which shows the current tab but doesn't announce it. Hold the items in a plain <ul> rather than Tabs.List, which marks its list as a tab list for Tabs.Tab. Each link is its own tab stop and keeps the browser's link behavior and Bulma's focus ring, in Bulma's focus color, width and style. For a link placed directly in the Tabs.Item, the bestax extras draw that ring inside the link, where the tab row would otherwise clip its top and bottom, and bring a focused toggle tab in front of the neighbors that overlap it. A selected toggle tab keeps the ring where Bulma draws it, so the row still clips its top and bottom there, except in forced colors, where it's drawn inside as well. The forced-colors bar applies to these tabs too.
  • Use clear text or icons with labels for each tab, and provide aria-label or screen-reader text for icon-only tabs.

  • Icon: Use for icons in tab labels.
  • Helper Props: Bulma helper props for spacing and other utilities.

Additional Resources​

Pro Tip

You can use Bulma helper props with <Tabs /> for powerful utility-based styling.


Props​

PropTypeDefaultDescription
align'centered' | 'right' | 'left'—Tab alignment.
size'small' | 'medium' | 'large'—Tab size.
isFullwidthbooleanfalseTabs expand to fill the horizontal space.
isFullWidthbooleanfalseDeprecated. Use isFullwidth instead — isFullwidth wins if both are set. Tabs expand to fill the horizontal space.
fullwidthbooleanfalseDeprecated. Use isFullwidth instead — isFullwidth wins if both are set. Tabs expand to fill the horizontal space.
boxedbooleanfalseTabs use the boxed style.
togglebooleanfalseTabs use the toggle style.
roundedbooleanfalseTabs use the rounded toggle style (only with toggle).
color'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger' | 'black' | 'dark' | 'light' | 'white'—Deprecated. No .tabs.is-<color> CSS exists; the prop renders unstyled and will be removed in the next major version. Bulma color for tab underlines and active state (renders is-<color>). Bulma ships no tabs color CSS, so this prop has never had a visual effect for any value. Passing it logs a console warning in development.
valuenumber—Controlled active tab index.
onChange(index: number) => void—Callback when active tab changes. Called with the tab's index when a Tabs.Tab is activated: clicked, or Enter or Space pressed on it. Moving focus with the arrow keys, Home or End does not call it, because activation is manual: focus moves freely and the selected tab changes only when the user picks one.
defaultValuenumber0Initial active tab index (uncontrolled).
verticalbooleanfalseRenders tabs vertically. With a Tabs.Content, the tab list is also marked aria-orientation="vertical" and ArrowUp and ArrowDown move focus between tabs, alongside ArrowLeft and ArrowRight (the layout stacks horizontally on mobile).
side'left' | 'right'—Side placement when vertical is true. The row follows the page's direction, so on a right-to-left page left puts the tabs at the right, where the line starts, and right puts them at the left.
expandedbooleanfalseMakes tabs take up the full width equally.
classNamestring—Additional CSS classes.
childrenReact.ReactNode—Tab list and tab items.
...All standard <div> attributes and Bulma helper props—See Helper Props

Subcomponents:

  • Tabs.List: The <ul role="tablist"> that holds the Tabs.Tabs. Navigation built from Tabs.Items goes in a plain <ul> instead.
  • Tabs.Tab: Individual tab button. Consumes Tabs context for active state management. Renders <a> internally — consumers provide only the label text/children. Inside a Tabs it takes part in the tab list's keyboard support and links to the Tabs.Content.Item with the same index.
  • Tabs.Item: A navigation tab: an <li> holding a link of your own, with an href. Put the items in a plain <ul>, and mark the current one with active and its link with aria-current="page". For tabs that switch what's shown in place, use Tabs.Tab with Tabs.Content, which handle the selection and the keyboard.
  • Tabs.Content: Container for tab content panels. No custom props beyond children and standard <div> HTML attributes. Applies the .tabs-content class.
  • Tabs.Content.Item: Individual content panel. Shows/hides based on active tab from context.

Tabs.List​

PropTypeDefaultDescription
classNamestring—Additional CSS classes.
childrenReact.ReactNode—Tab elements.
...All standard <ul> attributes—

Tabs.Tab​

PropTypeDefaultDescription
indexnumber—Required. Tab index for matching with content.
disabledbooleanfalseDisables the tab. A disabled tab is marked aria-disabled, cannot be activated, is skipped by the arrow keys, Home and End, and never holds the tab list's tab stop. The bestax extras styles also dim it and turn off its hover.
iconstring—Icon name for the tab.
iconLibrary'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols'—Icon library to use.
iconVariantstring—Icon style variant (e.g., 'solid', 'outlined', 'rounded').
iconSize'small' | 'medium' | 'large''small'Size of the tab icon.
iconFeaturesstring | string[]—Additional icon modifiers.
classNamestring—Additional CSS classes.
childrenReact.ReactNode—Tab label content.
idstring—The tab's id, which its panel names in aria-labelledby. Generated inside a Tabs when omitted; a passed id is used and the panel follows it.
onKeyDownReact.KeyboardEventHandler<HTMLLIElement>—Called before the tab handles the key; call event.preventDefault() to stop the tab handling it.
...All standard <li> attributes—

Tabs.Item​

PropTypeDefaultDescription
activebooleanfalseMarks the tab as the current one with Bulma's is-active class, and nothing else: no ARIA attribute says so. Put aria-current="page" on the link inside the current tab, so a screen reader announces it.
classNamestring—Additional CSS classes.
childrenReact.ReactNode—Tab content.
onClickReact.MouseEventHandler<HTMLLIElement>—Click handler.
...All standard <li> attributes—

Tabs.Content​

PropTypeDefaultDescription
classNamestring—Additional CSS classes.
childrenReact.ReactNode—TabContentItem elements.
...All standard <div> attributes—

Tabs.Content.Item​

PropTypeDefaultDescription
indexnumber—Required. Tab index for matching with content.
classNamestring—Additional CSS classes.
childrenReact.ReactNode—Panel content.
idstring—The panel's id, which its tab names in aria-controls. Generated inside a Tabs when omitted; a passed id is used and the tab follows it.
tabIndexnumber—The panel is not focusable by default. Pass 0 when it holds nothing focusable, so Tab moves from the tab list into it.
...All standard <div> attributes—

CSS & Sass Variables​

Tabs registers these variables on its own .tabs 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 VariableSass VariableDefault
--bulma-tabs-vertical-min-width ‡$tabs-vertical-min-width200px
--bulma-tabs-vertical-border-color ‡$tabs-vertical-border-colorvar(--bulma-border)
--bulma-tabs-vertical-border-width ‡$tabs-vertical-border-width1px
--bulma-tabs-content-padding ‡$tabs-content-padding1rem
--bulma-tabs-border-bottom-color$tabs-border-bottom-colorvar(--bulma-border)
--bulma-tabs-border-bottom-style$tabs-border-bottom-stylesolid
--bulma-tabs-border-bottom-width$tabs-border-bottom-width1px
--bulma-tabs-link-color$tabs-link-colorvar(--bulma-text)
--bulma-tabs-link-hover-border-bottom-color$tabs-link-hover-border-bottom-colorvar(--bulma-text-strong)
--bulma-tabs-link-hover-color$tabs-link-hover-colorvar(--bulma-text-strong)
--bulma-tabs-link-active-border-bottom-color$tabs-link-active-border-bottom-colorvar(--bulma-link-text)
--bulma-tabs-link-active-color$tabs-link-active-colorvar(--bulma-link-text)
--bulma-tabs-link-padding$tabs-link-padding0.5em 1em
--bulma-tabs-boxed-link-radius$tabs-boxed-link-radiusvar(--bulma-radius)
--bulma-tabs-boxed-link-hover-background-color$tabs-boxed-link-hover-background-colorvar(--bulma-background)
--bulma-tabs-boxed-link-hover-border-bottom-color$tabs-boxed-link-hover-border-bottom-colorvar(--bulma-border)
--bulma-tabs-boxed-link-active-background-color$tabs-boxed-link-active-background-colorvar(--bulma-scheme-main)
--bulma-tabs-boxed-link-active-border-color$tabs-boxed-link-active-border-colorvar(--bulma-border)
--bulma-tabs-boxed-link-active-border-bottom-color$tabs-boxed-link-active-border-bottom-colortransparent
--bulma-tabs-toggle-link-border-color$tabs-toggle-link-border-colorvar(--bulma-border)
--bulma-tabs-toggle-link-border-style$tabs-toggle-link-border-stylesolid
--bulma-tabs-toggle-link-border-width$tabs-toggle-link-border-width1px
--bulma-tabs-toggle-link-hover-background-color$tabs-toggle-link-hover-background-colorvar(--bulma-background)
--bulma-tabs-toggle-link-hover-border-color$tabs-toggle-link-hover-border-colorvar(--bulma-border-hover)
--bulma-tabs-toggle-link-radius$tabs-toggle-link-radiusvar(--bulma-radius)
--bulma-tabs-toggle-link-active-background-color$tabs-toggle-link-active-background-colorvar(--bulma-link)
--bulma-tabs-toggle-link-active-border-color$tabs-toggle-link-active-border-colorvar(--bulma-link)
--bulma-tabs-toggle-link-active-color$tabs-toggle-link-active-colorvar(--bulma-link-invert)

‡ declared on a constituent element: values set via className, the style prop, or an ancestor are only inherited and lose — target the declaring element in your CSS.