Tabs
DTabs renders a tabs strip with role=tablist, supports
@bind-ActiveKey and can render the active panel through a
PanelContent fragment (with Context).
tabs-bordered
Content for tab css
<DTabs Items="_items" @bind-ActiveKey="_active1" Variant="DaisyTabsVariant.Bordered">
<PanelContent Context="key">
<div class="p-4">
<p>Content for tab <span class="badge badge-primary">@key</span></p>
</div>
</PanelContent>
</DTabs>
@code {
private readonly List<DTabItem> _items =
[
new("html", "HTML"),
new("css", "CSS"),
new("js", "JS"),
];
private string _active1 = "css";
}tabs-lifted
Lifted panel showing html
<DTabs Items="_items" @bind-ActiveKey="_active2" Variant="DaisyTabsVariant.Lifted">
<PanelContent Context="key">
<div class="p-4">
<p>Lifted panel showing <code>@key</code></p>
</div>
</PanelContent>
</DTabs>
@code {
private readonly List<DTabItem> _items =
[
new("html", "HTML"),
new("css", "CSS"),
new("js", "JS"),
];
private string _active2 = "html";
}tabs-box— No PanelContent provided — only the strip is rendered.
Active: js
<DTabs Items="_items" @bind-ActiveKey="_active3" Variant="DaisyTabsVariant.Box" />
<p class="mt-2 text-sm opacity-70">Active: <code>@_active3</code></p>
@code {
private readonly List<DTabItem> _items =
[
new("html", "HTML"),
new("css", "CSS"),
new("js", "JS"),
];
private string _active3 = "js";
}API
DTabs
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Items | IEnumerable<DTabItem> | — | — | The tabs to render. |
| ActiveKey | string | — | @bind-ActiveKey | The currently active tab key. Supports two-way binding (@bind-ActiveKey). |
| Variant | DaisyTabsVariant | Bordered | — | Tab strip style (tabs-bordered, tabs-lifted, tabs-box). DefaultBorderedLiftedBox |
| PanelContent | RenderFragment<string> | — | — | Optional panel renderer. When provided, the panel for the active tab is rendered below the tab strip. Use with Context to name the key parameter. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |