Feedback
TwEmpty
TwEmpty is a Blazor empty state component for when there is no data yet. Set Icon, Title, Description and actions, with Outlined, Filled and Size variants.
Last updated
Basic usage
TwEmpty a Title and a Description that says why there is nothing here. The icon defaults to Icon.Inbox, and without a Title the localized text "No data" is shown.No messages yet
When someone sends you a message it will show up here.
<TwEmpty Title="No messages yet" Description="When someone sends you a message it will show up here." />Actions
ActionText and OnAction (or ActionHref) for a primary button, and SecondaryActionText for an outlined one beside it. Put anything else in ActionContent; give it basis-full to put it on a row of its own, as the link here does.No projects yet
You haven't created any projects yet. Get started by creating your first project.
<TwEmpty Icon="Icon.Folder2_Open"
Title="No projects yet"
Description="You haven't created any projects yet. Get started by creating your first project."
ActionText="Create project"
ActionIcon="Icon.Plus_Lg"
OnAction="@(() => projectsCreated++)"
SecondaryActionText="Import project"
OnSecondaryAction="@(() => projectsCreated++)">
<ActionContent>
<div class="basis-full text-center text-sm">
<TwLink Href="/empty">Learn more</TwLink>
</div>
</ActionContent>
</TwEmpty>Media
MediaVariant="EmptyMediaVariant.Plain" for a larger icon with no tile, Color to tint it, or AvatarSrc / AvatarName to show a TwAvatar instead. MediaContent takes any markup, and Icon="null" shows no media at all.No notifications
You're all caught up.
You're offline
Check your connection and try again.
Jane hasn't posted yet
Follow Jane to see her posts here.
No media
This empty state has no icon.
<div class="grid gap-4 md:grid-cols-2">
<TwEmpty Icon="Icon.Bell" Color="Color.Primary" Title="No notifications" Description="You're all caught up." Outlined />
<TwEmpty Icon="Icon.Cloud_Slash" MediaVariant="EmptyMediaVariant.Plain" Title="You're offline" Description="Check your connection and try again." Outlined />
<TwEmpty AvatarName="Jane Doe" Title="Jane hasn't posted yet" Description="Follow Jane to see her posts here." Outlined />
<TwEmpty Title="No media" Description="This empty state has no icon." Icon="null" Outlined />
</div>Outlined and filled
Outlined for a dashed border that marks out the empty area, such as a drop zone, or Filled for a subtle background. They can be combined, and both follow the theme's rounding.Outlined
A dashed border.
Filled
A subtle background.
Both
A dashed border on a subtle background.
<div class="grid gap-4 md:grid-cols-3">
<TwEmpty Icon="Icon.Upload" Title="Outlined" Description="A dashed border." Outlined />
<TwEmpty Icon="Icon.Inboxes" Title="Filled" Description="A subtle background." Filled />
<TwEmpty Icon="Icon.Search" Title="Both" Description="A dashed border on a subtle background." Outlined Filled />
</div>Sizes
Size to Size.Sm, Size.Md (the default) or Size.Lg. It scales the padding, the media and the text.Small
For tight spaces such as a card or a menu.
Medium
The default size.
Large
For a whole page or section.
<div class="grid gap-4 md:grid-cols-3">
<TwEmpty Size="Size.Sm" Title="Small" Description="For tight spaces such as a card or a menu." Outlined />
<TwEmpty Size="Size.Md" Title="Medium" Description="The default size." Outlined />
<TwEmpty Size="Size.Lg" Title="Large" Description="For a whole page or section." Outlined />
</div>In a card
TwCard. Set TitleLevel so its heading sits below the card's own heading in the page outline.Recent orders
Purchases from the last 30 days.
Wishlist
Items you have saved for later.
In a data table
TwEmpty in a TwDataTable's EmptyContent to replace the plain "No data available." message.| Invoice | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
No invoices yetInvoices you send will be listed here. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TwDataTable TItem="string" Items="@invoices">
<TableHeader>
<tr>
<th scope="col" class="px-6 py-3">Invoice</th>
</tr>
</TableHeader>
<TableRow Context="invoice">
<td class="px-6 py-4">@invoice</td>
</TableRow>
<EmptyContent>
<TwEmpty Size="Size.Sm" TitleLevel="4" Icon="Icon.Receipt" Title="No invoices yet" Description="Invoices you send will be listed here." />
</EmptyContent>
</TwDataTable>Search results
Live when the empty state replaces results in response to the user, so screen readers announce it. Extra content, such as a hint, goes in ChildContent.No results
Nothing matches "kiwi fruit".
Accessibility
Title and Description carry the message. The title is an h3 by default; set TitleLevel (1 to 6) to fit the page's heading outline. Set Live to make the empty state a role="status" live region when it appears after a search or filter. Some screen readers only announce a live region that was already on the page, so for a reliable announcement also update a persistent status, such as a result count. Giving it an AriaLabel without Live makes it a named region. Layout uses logical properties, so it mirrors in a right to left layout.
Theme configuration
TwBlazorTheme.Components (a TwEmptyTheme), 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 | |
Outlined |
string | |
Filled |
string | |
Small |
string | |
Medium |
string | |
Large |
string | |
Media |
string | |
Tile |
string | |
TileNeutral |
string | |
TileSmall |
string | |
TileMedium |
string | |
TileLarge |
string | |
PlainIcon |
string | |
PlainIconSmall |
string | |
PlainIconMedium |
string | |
PlainIconLarge |
string | |
Header |
string | |
Title |
string | |
TitleSmall |
string | |
TitleMedium |
string | |
TitleLarge |
string | |
Description |
string | |
DescriptionSmall |
string | |
DescriptionMedium |
string | |
DescriptionLarge |
string | |
Content |
string | |
Actions |
string |
Global Theme Configuration
TwBlazorTheme, rather than being unique to this component.
| Property | Type | Controls |
|---|---|---|
TileColors |
TwBlazorPalette |
Full reference: TwEmptyTheme on the API docs.