Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Context Menu
  • Drawer
  • Footer
  • Menu
  • Navbar
  • On This Page
  • Separator
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Container
  • Flex
  • Grid
  • Text
  • Link
  • Button
  • Form
    • AutocompleteNew
    • Checkbox
    • Color Picker
    • Date Picker
    • Date Range Picker
    • Datetime Picker
    • Datetime Range Picker
    • File Upload
    • Input GroupNew
    • NumericNew
    • Masked InputNew
    • Radio Button
    • Range SliderNew
    • RatingNew
    • Select
    • Slider
    • Switch
    • Tag InputNew
    • Text EditorNew
    • Textfield
    • Time Picker
    • Time Range Picker
  • Toggle
  • Toggle Group
  • Alert
  • Avatar
  • Badge
  • Chip
  • Empty
  • Icon
  • Popover
  • Progress
  • Skeleton
  • Spinner
  • Tooltip
  • Data Table
  • SpreadsheetNew
  • Column Filter Editor
  • Pagination
  • Pick List
  • Barcode
  • QR Code
  • Calendar
  • Table
  • Attachment
  • Overview
    • Bar
    • Bullet
    • Column
    • Dot Plot
    • Dumbbell
    • Icon
    • Lollipop
    • Radial Bar
    • Range
    • Word Cloud
    • Area
    • Bump
    • Bump Area
    • Candlestick
    • Gantt
    • Horizon
    • Line
    • Slope
    • Small Multiples
    • Stream Graph
    • Funnel
    • Gauge
    • Marimekko
    • Nightingale
    • Pie
    • Treemap
    • Waffle
    • Waterfall
    • Circular Treemap
    • Convex Treemap
    • Dendrogram
    • Sunburst
    • Barcode
    • Beeswarm
    • Box Plot
    • Density Plot
    • Histogram
    • Radial Histogram
    • Ridgeline
    • Strip Plot
    • Violin Plot
    • Categorical Scatter
    • Contour
    • Hexagonal Binning
    • Quadrant
    • Scatter
    • Heatmap
    • Matrix
    • Parallel Coordinates
    • Radar
    • Arc Diagram
    • Chord Diagram
    • Flowchart
    • Network Diagram
    • Sankey
    • Euler Diagram
    • Venn Diagram
  • Bubble
  • Marker
  • Message
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Layout

TwTabs

TwTabs is a Blazor tabs component, built from TwTabContainer and TwTab. Set Label, Icon, Color, Dense and Disabled, and scroll tabs that do not fit.

Last updated 5 November 2026

Basic tabs

Use TwTabContainer and TwTab to split content into switchable panels. By default the tab bar floats on its own as a segmented control, separate from the content below it.

This is the content of Tab 1.

RAZOR
<TwTabContainer AriaLabel="Example tabs 1">
    <TwTab Label="Tab 1">
        <p>This is the content of Tab 1.</p>
    </TwTab>
    <TwTab Label="Tab 2">
        <p>This is the content of Tab 2.</p>
    </TwTab>
</TwTabContainer>

Container tab colors

Set TabColor on TwTabContainer to choose the colour of the selected tab's label. Unselected tabs stay neutral, so the selected tab is always the one that stands out.

Setting the TabColor property on the TwTabContainer sets the selected colour for every tab within that container.

RAZOR
<TwTabContainer AriaLabel="Example tabs 2" TabColor="Color.Accent">
    <TwTab Label="Tab 1">
        <p>Setting the <code>TabColor</code> property on the <code>TwTabContainer</code> sets the selected colour for every tab within that container.</p>
    </TwTab>
    <TwTab Label="Tab 2">
        <p>This is the content of Tab 2.</p>
    </TwTab>
    <TwTab Label="Tab 3">
        <p>This is the content of Tab 2.</p>
    </TwTab>
</TwTabContainer>

Single tab colors

Set Color on an individual TwTab to give just that tab its own selected colour. Select each tab below to see it.

Setting the Color property on an individual tab sets the colour it uses while it is selected.

RAZOR
<TwTabContainer AriaLabel="Example tabs 3">
    <TwTab Label="Tab 1" Color="Color.Danger">
        <p>Setting the <code>Color</code> property on an individual tab sets the colour it uses while it is selected.</p>
    </TwTab>
    <TwTab Label="Tab 2" Color="Color.Success">
        <p>This is the content of Tab 2.</p>
    </TwTab>
    <TwTab Label="Tab 3" Color="Color.Primary">
        <p>This is the content of Tab 3.</p>
    </TwTab>
</TwTabContainer>

Tabs with cards

The tab panel has no border or background of its own, so content that brings its own surfaces, such as cards, sits directly on the page below the tab bar.

Revenue

Revenue is up 12% on last month.

Customers

48 new customers signed up this week.

RAZOR
<TwTabContainer AriaLabel="Example tabs 6">
    <TwTab Label="Overview">
        <div class="grid gap-4 sm:grid-cols-2">
            <TwCard Title="Revenue">
                <p>Revenue is up 12% on last month.</p>
            </TwCard>
            <TwCard Title="Customers">
                <p>48 new customers signed up this week.</p>
            </TwCard>
        </div>
    </TwTab>
    <TwTab Label="Activity">
        <TwCard Title="Recent activity">
            <p>No new activity since your last visit.</p>
        </TwCard>
    </TwTab>
    <TwTab Label="Settings">
        <TwCard Title="Settings">
            <p>Manage your notification preferences.</p>
        </TwCard>
    </TwTab>
</TwTabContainer>

Container tabs

Set Container on TwTabContainer to draw underlined tabs joined to a bordered panel. This suits plain text or form fields that have no surface of their own. Add TransparentContainer to drop the container's background and keep only its border. Keyboard navigation works the same in both layouts.

Update your name, photo and contact details.

RAZOR
<TwTabContainer AriaLabel="Example tabs 7" Container>
    <TwTab Label="Profile">
        <p>Update your name, photo and contact details.</p>
    </TwTab>
    <TwTab Label="Security">
        <p>Change your password and manage two step verification.</p>
    </TwTab>
    <TwTab Label="Billing">
        <p>View invoices and update your payment method.</p>
    </TwTab>
</TwTabContainer>

Dense tabs

Set Dense on TwTabContainer to render more compact tabs.

This is the content of Tab 1.

RAZOR
<TwTabContainer AriaLabel="Example tabs 4" Dense>
    <TwTab Label="Tab 1">
        <p>This is the content of Tab 1.</p>
    </TwTab>
    <TwTab Label="Tab 2">
        <p>This is the content of Tab 2.</p>
    </TwTab>
</TwTabContainer>

Disabled tabs

Set Disabled on a TwTab to prevent it from being selected.

This is the content of Tab 1.

RAZOR
<TwTabContainer AriaLabel="Example tabs 5" Dense>
    <TwTab Label="Tab 1">
        <p>This is the content of Tab 1.</p>
    </TwTab>
    <TwTab Label="Disabled" Disabled>
        <p>This is the content of Tab 2.</p>
    </TwTab>
</TwTabContainer>

Scrollable tabs with icons

Set Scrollable to keep the tabs on one line. When they do not fit, arrow buttons appear at the ends to scroll them, and the arrow keys bring the focused tab into view. Give a TwTab an Icon to show it before the label, and use TabBarContent for controls that sit beside the tabs.

Overview content.

RAZOR
<div class="max-w-md">
    <TwTabContainer AriaLabel="Example tabs 6" Scrollable Dense>
        <TabBarContent>
            <TwButton Label="New" StartIcon="Icon.Plus_Lg" Dense />
        </TabBarContent>
        <ChildContent>
            <TwTab Label="Overview" Icon="Icon.Speedometer2"><p>Overview content.</p></TwTab>
            <TwTab Label="Analytics" Icon="Icon.Bar_Chart_Line"><p>Analytics content.</p></TwTab>
            <TwTab Label="Customers" Icon="Icon.People"><p>Customers content.</p></TwTab>
            <TwTab Label="Invoices" Icon="Icon.Receipt"><p>Invoices content.</p></TwTab>
            <TwTab Label="Settings" Icon="Icon.Gear"><p>Settings content.</p></TwTab>
        </ChildContent>
    </TwTabContainer>
</div>

Keyboard navigation

The tab list is a single Tab stop, and moving to a tab shows its panel straight away. Disabled tabs are skipped. In a right to left layout Arrow Left moves to the next tab and Arrow Right to the previous one.
Key What it does
Tab Moves focus to the selected tab, then to the tab panel, then on to the panel's content.
Arrow Right or Arrow Down Moves to the next tab and shows it. From the last tab it wraps to the first.
Arrow Left or Arrow Up Moves to the previous tab and shows it. From the first tab it wraps to the last.
Home or End Moves to the first or last tab.

Theme configuration

Styling is controlled by TwBlazorTheme.Components (a TwTabTheme), configured via the AddTwBlazor() options callback described on the Get Started page. Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Property Type Controls
TabBase string
TabPadding string
TabDensePadding string
ActiveIndicator string
InactiveIndicator string
DisabledTab string
TabListContainer string
PanelContainer string
Background string
IsolatedTabListContainer string
IsolatedTab string
IsolatedTabPadding string
IsolatedTabDensePadding string
IsolatedActiveTab string
IsolatedInactiveTab string
IsolatedPanelContainer string
TabBar string
TabBarContent string
ScrollContainer string
ScrollableTabList string
ScrollButton string
ScrollButtonStart string
ScrollButtonEnd string

Full reference: TwTabTheme on the API docs.

On this page

  • Basic tabs
  • Container tab colors
  • Single tab colors
  • Tabs with cards
  • Container tabs
  • Dense tabs
  • Disabled tabs
  • Scrollable tabs with icons
  • Keyboard navigation
  • Theme configuration
twblazor

The Tailwind CSS component library for Blazor. Accessible, themeable and MIT licensed.

Discord (opens in a new tab) GitHub(opens in a new tab)

Get started

  • Install guide
  • Theming
  • Class merging
  • Localization

Guides

  • Tailwind CSS with Blazor
  • Why twblazor?
  • Right to left
  • AI agents and skills

Resources

  • API documentation (opens in a new tab)
  • llms.txt (opens in a new tab)
  • MIT License (opens in a new tab)

Community

  • Contributing (opens in a new tab)
  • Code of conduct (opens in a new tab)
  • Report an issue (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload