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
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
Closable Chips
Use
Closable and OnClose to create removable tags.JavaScriptTypeScriptReactNode.jsMongoDB
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
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
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.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>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 | |
Sm |
string | |
Md |
string | |
Lg |
string |
Full reference: TwChipTheme on the API docs.