Icons
daisyUI ships no icons, so DaisyBlazorUI provides DIcon with a deliberately
minimal built-in set (DaisyIcon.FromUrl instead of bloating the assembly.
@foreach (var icon in DaisyIcons.All)
{
<DIcon Icon="@icon" Size="DaisySize.Large" />
}<DIcon Icon="@DaisyIcons.Warning" Size="DaisySize.ExtraSmall" />
<DIcon Icon="@DaisyIcons.Warning" Size="DaisySize.Small" />
<DIcon Icon="@DaisyIcons.Warning" Size="DaisySize.Medium" />
<DIcon Icon="@DaisyIcons.Warning" Size="DaisySize.Large" />
<DIcon Icon="@DaisyIcons.Info" StrokeWidth="0.75" Size="DaisySize.Large" />
<DIcon Icon="@DaisyIcons.Info" StrokeWidth="3" Size="DaisySize.Large" /><span class="flex items-center gap-2"><DIcon Icon="@DaisyIcons.Search" /> primary</span>
<span class="flex items-center gap-2 text-[var(--color-success)]"><DIcon Icon="@DaisyIcons.Success" /> success</span>
<span class="flex items-center gap-2 text-[var(--color-warning)]"><DIcon Icon="@DaisyIcons.Warning" /> warning</span>
<span class="flex items-center gap-2 text-[var(--color-error)]"><DIcon Icon="@DaisyIcons.Error" /> error</span>
<DButton Color="DaisyColor.Primary" IconStart="@DaisyIcons.Plus">Icon inside a button matches its label</DButton>
Remote glyphs are rendered as a CSS mask over
<DIcon Icon="@icon" Size="DaisySize.Large" />
<DButton Color="DaisyColor.Accent" IconStart="@DaisyIcon.FromUrl("brain", "https://api.iconify.design/lucide/brain.svg")">CDN icon in a button</DButton>
<DAlert Color="DaisyColor.Info" Icon="@DaisyIcon.FromUrl("siren", "https://api.iconify.design/lucide/siren.svg")">CDN icon in an alert</DAlert>
@code {
private static readonly DaisyIcon[] _remoteIcons =
[
DaisyIcon.FromUrl("rocket", "https://api.iconify.design/lucide/rocket.svg"),
DaisyIcon.FromUrl("brain", "https://api.iconify.design/lucide/brain.svg"),
DaisyIcon.FromUrl("sparkles", "https://api.iconify.design/lucide/sparkles.svg"),
DaisyIcon.FromUrl("ghost", "https://api.iconify.design/lucide/ghost.svg"),
DaisyIcon.FromUrl("pizza", "https://api.iconify.design/lucide/pizza.svg"),
DaisyIcon.FromUrl("siren", "https://api.iconify.design/lucide/siren.svg"),
];
}API
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Icon | DaisyIcon | — | — | The icon to render (built-in from DaisyIcons or String) ). |
| Size | DaisySize | Medium | — | Rendered size (xs=12px, sm=14px, md=16px, lg=20px) via inline width/height. ExtraSmallSmallMediumLargeExtraLarge |
| StrokeWidth | double | 1.5 | — | Stroke width for built-in glyphs (heroicons geometry is designed for 1.5). |
| Label | string | — | — | Accessible label. When set the icon gets role="img" + aria-label ; otherwise it is hidden from assistive tech (decorative). |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Type | string | button | — | The native type attribute: button , submit or reset . |
| Color | DaisyColor | Default | — | Contextual color (e.g. btn-primary , btn-ghost ); Default emits no class. DefaultPrimarySecondaryAccentInfoSuccessWarningErrorGhostNeutral |
| Variant | DaisyVariant | Default | — | Style variant (e.g. btn-outline , btn-soft ); Default emits no class. DefaultOutlineDashSoftLink |
| Size | DaisySize | Medium | — | Size (e.g. btn-xs , btn-lg ); Medium emits no class. ExtraSmallSmallMediumLargeExtraLarge |
| Disabled | bool | False | — | Disables the button (native disabled ). |
| IconStart | DaisyIcon | — | — | Icon rendered before the button content (daisy's btn gap handles spacing). |
| IconEnd | DaisyIcon | — | — | Icon rendered after the button content. |
| IconSize | DaisySize? | — | — | Icon size; defaults to the button Size when null . ExtraSmallSmallMediumLargeExtraLarge |
| Shape | DaisyButtonShape | Default | — | btn-square / btn-circle — use with an icon and no text for icon-only buttons. DefaultSquareCircle |
| Wide | bool | False | — | btn-wide : widens the button to width:100% of its container, capped at 16rem . When both Wide and Block are set, btn-block wins on width (it is declared later in daisyUI's cascade at equal specificity) and the button fills its container, still capped at 16rem by btn-wide 's max-width . |
| Block | bool | False | — | btn-block : the button fills the full width of its container ( width:100% ). When both Block and Wide are set, btn-block wins on width (it is declared later in daisyUI's cascade at equal specificity). |
| ChildContent | RenderFragment | — | — | The button's inner text and content. |
| OnClick | EventCallback<MouseEventArgs> | — | — | Invoked when the button is clicked. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Color | DaisyColor | Default | — | Contextual color (e.g. alert-info , alert-success ); Default emits no class. DefaultPrimarySecondaryAccentInfoSuccessWarningErrorGhostNeutral |
| Variant | DaisyVariant | Default | — | Style variant (e.g. alert-outline , alert-soft ); Default emits no class. DefaultOutlineDashSoftLink |
| Icon | DaisyIcon | — | — | Optional leading icon (e.g. DaisyIcons.Warning or a CDN icon via DaisyIcon.FromUrl ). |
| IconSize | DaisySize | Large | — | Icon size for Icon . ExtraSmallSmallMediumLargeExtraLarge |
| ChildContent | RenderFragment | — | — | The alert's message content. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |