List
daisyUI 5.7's DList + DListItem wrap
Basic
Wi-Fi
Connected to “lab-5GHz”
Bluetooth
Off
AirDrop
Contacts only
restricted
<DList Class="max-w-xl border border-base-300 rounded-box p-2">
<DListItem>
<div>Wi-Fi</div>
<div class="list-col-grow opacity-70">Connected to “lab-5GHz”</div>
<div><input type="checkbox" class="toggle toggle-primary" checked /></div>
</DListItem>
<DListItem>
<div>Bluetooth</div>
<div class="list-col-grow opacity-70">Off</div>
<div><input type="checkbox" class="toggle" /></div>
</DListItem>
<DListItem>
<div>AirDrop</div>
<div class="list-col-grow opacity-70">Contacts only</div>
<div><span class="badge badge-sm badge-outline">restricted</span></div>
</DListItem>
</DList>Table-ish rows— Fixed columns + grow column
edge-1
up
12 ms
edge-2
up
18 ms
db-primary
up
4 ms
db-replica
down
0 ms
cache-1
up
1 ms
<DList Class="max-w-2xl border border-base-300 rounded-box p-2">
@foreach (var (name, status, ms) in _servers)
{
<DListItem>
<div class="font-semibold">@name</div>
<div class="list-col-grow">
<span class="badge badge-sm @(status == "up" ? "badge-success" : "badge-error") badge-outline">@status</span>
</div>
<div class="opacity-70">@ms ms</div>
<div><button class="btn btn-xs btn-ghost">Details</button></div>
</DListItem>
}
</DList>
@code {
private static readonly (string Name, string Status, int Ms)[] _servers =
[
("edge-1", "up", 12),
("edge-2", "up", 18),
("db-primary", "up", 4),
("db-replica", "down", 0),
("cache-1", "up", 1),
];
}Tips
- The grid adapts to how many
list-col-grow columns exist — usually you want exactly one. - Rows are cheap: hundreds of them stay CSS-only.
API
DList
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| ChildContent | RenderFragment | — | — | The DListItem rows. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |
DListItem
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| ChildContent | RenderFragment | — | — | Row columns. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |