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

Feedback

TwChip

TwChip is a Blazor chip component for tags and filters. Set Label, Color, Variant, Size, StartIcon, Avatar and Href, or make it Closable with OnClose.

Last updated 18 October 2026

Basic usage

Group chips with TwChipGroup for automatic wrapping and layout.
React Vue Angular Svelte Blazor
RAZOR
<TwChipGroup>
    <TwChip Label="React" Color="Color.Primary" />
    <TwChip Label="Vue" Color="Color.Success" />
    <TwChip Label="Angular" Color="Color.Danger" />
    <TwChip Label="Svelte" Color="Color.Accent" />
    <TwChip Label="Blazor" Color="Color.Accent" />
</TwChipGroup>

Sizes

Use Size to render a smaller or larger chip. Defaults to ChipSize.Medium.
Small Medium Large
RAZOR
<TwChipGroup Class="items-center">
    <TwChip Label="Small" Color="Color.Primary" Size="ChipSize.Small" />
    <TwChip Label="Medium" Color="Color.Primary" Size="ChipSize.Medium" />
    <TwChip Label="Large" Color="Color.Primary" Size="ChipSize.Large" />
</TwChipGroup>

Colors

Group chips with TwChipGroup for automatic wrapping and layout.
Primary
Accent
Success
Danger
Warning
Info
Light
Dark
RAZOR
@foreach (Color c in ((Color[])Enum.GetValues(typeof(Color))).Take(10))
{
    <TwChipGroup>
        @if (c != Color.Light && c != Color.Dark)
        {
            <div class="p-3">
                <TwChip Label="@c.ToString()" Color="@c" />
            </div>
        }
        else
        {
            <div class="@(c == Color.Light ? "bg-gray-900 p-3 rounded-lg" : "bg-white p-3 rounded-lg")">
                <TwChip Label="@c.ToString()" Color="@c" />
            </div>
        }
    </TwChipGroup>
}

Closable chips

Use Closable and OnClose to create removable tags.
JavaScriptTypeScriptReactNode.jsMongoDB
RAZOR
<TwChipGroup>
    @foreach (var tag in _tags)
    {
        <TwChip Label="@tag"
                Color="Color.Primary"
                Closable
                OnClose="@(() => RemoveTag(tag))" />
    }
</TwChipGroup>
CSHARP
@code {
    private readonly List<string> _tags = new() { "JavaScript", "TypeScript", "React", "Node.js", "MongoDB" };
    
    private void RemoveTag(string tag)
    {
        _tags.Remove(tag);
    }
}

Alignment & spacing

Control alignment with Alignment and adjust spacing with Class="gap-*".

Center aligned with custom spacing

Chip 1 Chip 2 Chip 3

End aligned with tight spacing

Tight Spacing Example
RAZOR
<div class="space-y-6">
    <div>
        <p class="text-xs text-gray-500 dark:text-gray-400 mb-2">Center aligned with custom spacing</p>
        <TwChipGroup Alignment="center" Class="gap-4">
            <TwChip Label="Chip 1" Color="Color.Success" Variant="ButtonVariant.Outlined" />
            <TwChip Label="Chip 2" Color="Color.Success" Variant="ButtonVariant.Outlined" />
            <TwChip Label="Chip 3" Color="Color.Success" Variant="ButtonVariant.Outlined" />
        </TwChipGroup>
    </div>

    <div>
        <p class="text-xs text-gray-500 dark:text-gray-400 mb-2">End aligned with tight spacing</p>
        <TwChipGroup Alignment="end" Class="gap-1">
            <TwChip Label="Tight" Color="Color.Accent" Variant="ButtonVariant.Outlined" Size="ChipSize.Small" />
            <TwChip Label="Spacing" Color="Color.Accent" Variant="ButtonVariant.Outlined" Size="ChipSize.Small" />
            <TwChip Label="Example" Color="Color.Accent" Variant="ButtonVariant.Outlined" Size="ChipSize.Small" />
        </TwChipGroup>
    </div>
</div>

With icons & variants

Add icons with StartIcon/EndIcon and use different variants for various use cases.

Skills with start icons

C# Blazor ASP.NET SQL

Actions with end icons

Download Share Delete

Status indicators

Active Pending Inactive Error
RAZOR
<div class="mb-6">
    <p class="text-xs text-gray-500 dark:text-gray-400 mb-2">Skills with start icons</p>
    <TwChipGroup Class="gap-3">
        <TwChip Label="C#" StartIcon="Icon.Code" Color="Color.Accent" Variant="ButtonVariant.Filled" />
        <TwChip Label="Blazor" StartIcon="Icon.Lightning" Color="Color.Primary" Variant="ButtonVariant.Filled" />
        <TwChip Label="ASP.NET" StartIcon="Icon.Globe" Color="Color.Success" Variant="ButtonVariant.Filled" />
        <TwChip Label="SQL" StartIcon="Icon.Database" Color="Color.Accent" Variant="ButtonVariant.Filled" />
    </TwChipGroup>
</div>

<div class="mb-6">
    <p class="text-xs text-gray-500 dark:text-gray-400 mb-2">Actions with end icons</p>
    <TwChipGroup Class="gap-3">
        <TwChip Label="Download" EndIcon="Icon.Download" Color="Color.Primary" Variant="ButtonVariant.Outlined" />
        <TwChip Label="Share" EndIcon="Icon.Share" Color="Color.Success" Variant="ButtonVariant.Outlined" />
        <TwChip Label="Delete" EndIcon="Icon.Trash" Color="Color.Danger" Variant="ButtonVariant.Outlined" />
    </TwChipGroup>
</div>

<div>
    <p class="text-xs text-gray-500 dark:text-gray-400 mb-2">Status indicators</p>
    <TwChipGroup>
        <TwChip Label="Active" Color="Color.Success" Variant="ButtonVariant.Filled" Size="ChipSize.Small" />
        <TwChip Label="Pending" Color="Color.Accent" Variant="ButtonVariant.Filled" Size="ChipSize.Small" />
        <TwChip Label="Inactive" Color="Color.Primary" Variant="ButtonVariant.Outlined" Size="ChipSize.Small" />
        <TwChip Label="Error" Color="Color.Danger" Variant="ButtonVariant.Filled" Size="ChipSize.Small" />
    </TwChipGroup>
</div>

With avatars

Use the Avatar property to display initials or text at the start of the chip.
JDJohn Doe SSSarah Smith MJMike Johnson AAdmin
RAZOR
<TwChipGroup Class="gap-3">
    <TwChip Label="John Doe" Avatar="JD" Color="Color.Primary" Variant="ButtonVariant.Filled" />
    <TwChip Label="Sarah Smith" Avatar="SS" Color="Color.Accent" Variant="ButtonVariant.Filled" />
    <TwChip Label="Mike Johnson" Avatar="MJ" Color="Color.Success" Variant="ButtonVariant.Filled" />
    <TwChip Label="Admin" Avatar="A" Color="Color.Accent" Variant="ButtonVariant.Filled" Size="ChipSize.Small" />
</TwChipGroup>

Link chips

Use Href to make chips navigable. Use Target for external links.
Documentation GitHub API Reference
RAZOR
<TwChipGroup Class="gap-3">
    <TwChip Label="Documentation" Href="/" StartIcon="Icon.Book" Color="Color.Primary" Variant="ButtonVariant.Outlined" />
    <TwChip Label="GitHub" Href="https://github.com" Target="_blank" StartIcon="Icon.Github" Color="Color.Primary" Variant="ButtonVariant.Outlined" />
    <TwChip Label="API Reference" Href="/" EndIcon="Icon.Arrow_Right" Color="Color.Accent" Variant="ButtonVariant.Filled" />
</TwChipGroup>

Disabled state

Use the Disabled property to make chips non-interactive.
Enabled Disabled Disabled Outlined Disabled with Icon
RAZOR
<TwChipGroup>
    <TwChip Label="Enabled" Color="Color.Primary" Variant="ButtonVariant.Filled" />
    <TwChip Label="Disabled" Color="Color.Primary" Variant="ButtonVariant.Filled" Disabled />
    <TwChip Label="Disabled Outlined" Color="Color.Accent" Variant="ButtonVariant.Outlined" Disabled />
    <TwChip Label="Disabled with Icon" StartIcon="Icon.Lock" Color="Color.Primary" Variant="ButtonVariant.Filled" Disabled />
</TwChipGroup>

Keyboard navigation

A plain chip is not a Tab stop. A clickable chip is a button or a link, and a closable chip adds a remove button after it.
Key What it does
Tab Moves to the chip, then to its remove button.
Enter or Space Activates a clickable chip, or removes the chip when its remove button has focus.

Theme configuration

Styling is controlled by TwBlazorTheme.Components (a TwChipTheme), 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
Base string
CloseButton string
ContentButton string
Sm string
Md string
Lg string

Full reference: TwChipTheme on the API docs.

On this page

  • Basic usage
  • Sizes
  • Colors
  • Closable chips
  • Alignment & spacing
  • With icons & variants
  • With avatars
  • Link chips
  • Disabled state
  • 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