Fieldset & Validator
DFieldset groups related controls with a DValidator is a pure-CSS hint (
Fieldset
<form class="w-full max-w-sm">
<DFieldset Legend="Profile">
<label class="fieldset-label">Name</label>
<DInput Placeholder="Ada Lovelace" />
<label class="fieldset-label mt-2">Bio</label>
<DTextarea Rows="2" Placeholder="Analytical engine enthusiast" />
</DFieldset>
</form>Rich legend— Legend can mix text and components
<form class="w-full max-w-sm">
<DFieldset>
<LegendContent>
<span class="inline-flex items-center gap-2">
Notifications <span class="badge badge-info badge-sm">2</span>
</span>
</LegendContent>
<ChildContent>
<DCheckbox Label="Email digest" />
<DCheckbox Label="Desktop alerts" />
</ChildContent>
</DFieldset>
</form>Validator (CSS-only)— Blur the email field without fixing it — the hint appears via :user-invalid
Give us at least 10 characters.
<div class="w-full max-w-sm">
<label class="block w-full">
<DInput Type="email" Required="true" Validator="true" Placeholder="you@example.com" />
<DValidator>A valid email address is required.</DValidator>
</label>
<div class="mt-4 w-full">
<DTextarea Rows="2" Validator="true" Required Placeholder="At least 10 characters…" MinLength="10" />
<DValidator>Give us at least 10 characters.</DValidator>
</div>
</div>Tips
- The hint must be a sibling that follows the control inside the same parent element.
:user-invalid only fires after the user interacted with the field — it never yells at pristine forms.- For Blazor-side validation use
EditForm +DataAnnotations instead (see the Forms page); the two approaches can coexist.
API
DFieldset
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Legend | string | — | — | Legend text (rendered with daisyUI's fieldset-legend class). |
| LegendContent | RenderFragment | — | — | Rich legend content (e.g. an icon or badge). When used, wrap body content in <ChildContent> . |
| ChildContent | RenderFragment | — | — | The grouped form controls. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |
DValidator
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| ChildContent | RenderFragment | — | — | A CSS-only validation hint (daisyUI's validator-hint ): hidden by default and shown automatically when a preceding sibling control marked Validator="true" becomes :user-invalid . Pure browser behavior — works under static SSR with no Blazor circuit involved. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |
DInput
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Type | string | text | — | The HTML input type (text, password, email, number, date, ...). Default: text. |
| Placeholder | string | — | — | Placeholder text shown inside the input when empty. |
| Label | string | — | — | Optional label rendered above the input. |
| Size | DaisySize | Medium | — | Sizes the input via daisyUI (input-xs, input-sm, input-lg). ExtraSmallSmallMediumLargeExtraLarge |
| Disabled | bool | False | — | Disables the input. |
| Validator | bool | False | — | Adds daisyUI's validator class so a sibling DValidator hint can appear purely via CSS ( :user-invalid ) — no Blazor validation required. |
| Class | string | — | — | — |
| Style | string | — | — | — |
| Value | string | — | @bind-Value | — |
| ValueExpression | Expression<Func<string>> | — | — | — |
| DisplayName | string | — | — | — |
DTextarea
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Rows | int? | — | — | Number of visible text lines (native rows attribute). |
| Placeholder | string | — | — | Placeholder text shown when empty. |
| Label | string | — | — | Optional label rendered above the textarea. |
| Color | DaisyColor | Default | — | daisyUI color (textarea-primary, textarea-error, ...). DefaultPrimarySecondaryAccentInfoSuccessWarningErrorGhostNeutral |
| Size | DaisySize | Medium | — | Sizes the textarea (textarea-xs ... textarea-lg). ExtraSmallSmallMediumLargeExtraLarge |
| Disabled | bool | False | — | Disables the textarea. |
| Validator | bool | False | — | Adds daisyUI's validator class (see DValidator ). |
| Resize | DaisyResize | Both | — | Which directions the user can drag to resize the textarea. Defaults to Both — Tailwind's preflight restricts every <textarea> to resize: vertical , so we emit an inline resize declaration to restore full resizing. NoneBothHorizontalVertical |
| Class | string | — | — | — |
| Style | string | — | — | — |
| Value | string | — | @bind-Value | — |
| ValueExpression | Expression<Func<string>> | — | — | — |
| DisplayName | string | — | — | — |
DCheckbox
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Label | string | — | — | Optional label rendered next to the checkbox. |
| Disabled | bool | False | — | Disables the checkbox. |
| Size | DaisySize | Medium | — | Size via daisyUI (checkbox-xs/sm/lg). ExtraSmallSmallMediumLargeExtraLarge |
| Class | string | — | — | — |
| Style | string | — | — | — |
| Value | bool | False | @bind-Value | — |
| ValueExpression | Expression<Func<bool>> | — | — | — |
| DisplayName | string | — | — | — |