Skip to content
GitHub11 stars

Combine labels, controls, and help text to compose accessible form fields and grouped inputs.

Payment Method

All transactions are secure and encrypted

Enter your 16-digit card number

Billing Address

The billing address associated with your payment method

<div class="w-full max-w-md">
    <form>
        <FieldGroup>

Installation

dnx Blazix.Cli add field

Usage

<FieldSet>
    <FieldLegend>Profile</FieldLegend>
    <FieldDescription>This appears on invoices and emails.</FieldDescription>
    <FieldGroup>
        <Field>
            <FieldLabel for="name">Full name</FieldLabel>
            <Input id="name" autocomplete="off" placeholder="Evil Rabbit" />
            <FieldDescription>This appears on invoices and emails.</FieldDescription>
        </Field>
        <Field>
            <FieldLabel for="username">Username</FieldLabel>
            <Input id="username" autocomplete="off" aria-invalid="true" />
            <FieldError>Choose another username.</FieldError>
        </Field>
        <Field Orientation="FieldOrientation.Horizontal">
            <Switch id="newsletter" />
            <FieldLabel for="newsletter">Subscribe to the newsletter</FieldLabel>
        </Field>
    </FieldGroup>
</FieldSet>

Composition

Field

A single control with label, helper text, and validation.

Field
├── FieldLabel
├── Input / Textarea / Switch / Select
├── FieldDescription
└── FieldError

FieldGroup

Related fields in one group. Use FieldSeparator between sections when needed.

FieldGroup
├── Field
│   ├── FieldLabel
│   ├── Input / Textarea / Switch / Select
│   ├── FieldDescription
│   └── FieldError
├── FieldSeparator
└── Field
    ├── FieldLabel
    └── Input / Textarea / Switch / Select

FieldSet

Semantic grouping with a legend and description, usually containing a FieldGroup.

FieldSet
├── FieldLegend
├── FieldDescription
└── FieldGroup
    ├── Field
    │   ├── FieldLabel
    │   ├── Input / Textarea / Switch / Select
    │   ├── FieldDescription
    │   └── FieldError
    └── Field
        ├── FieldLabel
        └── Input / Textarea / Switch / Select

Anatomy

The Field family is designed for composing accessible forms. A typical field is structured as follows, with its control (an Input, Select, Switch and so on) after the label:

<Field>
    <FieldLabel for="input-id">Label</FieldLabel>
    <Input id="input-id" />
    <FieldDescription>Optional helper text.</FieldDescription>
    <FieldError>Validation message.</FieldError>
</Field>
  • Field is the core wrapper for a single field.
  • FieldContent is a flex column that groups label and description. Not required if you have no description.
  • Wrap related fields with FieldGroup, and use FieldSet with FieldLegend for semantic grouping.

Form

Use it inside an EditForm or a plain <form>: Field only lays out and labels the controls.

Input

Choose a unique username for your account.

Must be at least 8 characters long.

<FieldSet Class="w-full max-w-xs">
    <FieldGroup>
        <Field>

Textarea

Share your thoughts about our service.

<FieldSet Class="w-full max-w-xs">
    <FieldGroup>
        <Field>
            <FieldLabel for="feedback">Feedback</FieldLabel>
            <Textarea id="feedback" placeholder="Your feedback helps us improve..." rows="4" />
            <FieldDescription>Share your thoughts about our service.</FieldDescription>
        </Field>
    </FieldGroup>
</FieldSet>

Select

Select your department or area of work.

<Field Class="w-full max-w-xs">
    <FieldLabel for="department">Department</FieldLabel>
    <Select Items="Items">

Slider

Price Range

Set your budget range ($200 - 800).

<Field Class="w-full max-w-xs">
    <FieldTitle>Price Range</FieldTitle>
    <FieldDescription>

Fieldset

Address Information

We need your address to deliver your order.

<FieldSet Class="w-full max-w-sm">
    <FieldLegend>Address Information</FieldLegend>
    <FieldDescription>We need your address to deliver your order.</FieldDescription>

Checkbox

Show these items on the desktop

Select the items you want to show on the desktop.

Your Desktop & Documents folders are being synced with iCloud Drive. You can access them from other devices.

<FieldGroup Class="w-full max-w-xs">
    <FieldSet>
        <FieldLegend Variant="FieldLegendVariant.Label">Show these items on the desktop</FieldLegend>

Radio

Subscription Plan

Yearly and lifetime plans offer significant savings.

<FieldSet Class="w-full max-w-xs">
    <FieldLegend Variant="FieldLegendVariant.Label">Subscription Plan</FieldLegend>
    <FieldDescription>Yearly and lifetime plans offer significant savings.</FieldDescription>

Switch

<Field Orientation="FieldOrientation.Horizontal" Class="w-fit">
    <FieldLabel for="2fa">Multi-factor authentication</FieldLabel>
    <Switch id="2fa" />
</Field>

Choice Card

Wrap Field components inside FieldLabel to create selectable field groups. This works with RadioItem, Checkbox and Switch components.

Compute Environment

Select the compute environment for your cluster.

<FieldGroup Class="w-full max-w-xs">
    <FieldSet>
        <FieldLegend Variant="FieldLegendVariant.Label">Compute Environment</FieldLegend>

Field Group

Stack Field components with FieldGroup. Add FieldSeparator to divide them.

Get notified when ChatGPT responds to requests that take time, like research or image generation.

Get notified when tasks you've created have updates. Manage tasks

<FieldGroup Class="w-full max-w-xs">
    <FieldSet>
        <FieldLabel>Responses</FieldLabel>

Responsive Layout

  • Vertical fields: Default orientation stacks label, control, and helper text—ideal for mobile-first layouts.
  • Horizontal fields: Set orientation="horizontal" on Field to align the label and control side-by-side. Pair with FieldContent to keep descriptions aligned.
  • Responsive fields: Set orientation="responsive" for automatic column layouts inside container-aware parents. Apply @container/field-group classes on FieldGroup to switch orientations at specific breakpoints.
Profile

Fill in your profile information.

Provide your full name for identification

<div class="w-full max-w-lg">
    <form>
        <FieldSet>

Validation and Errors

  • Add data-invalid to Field to switch the entire block into an error state.
  • Add aria-invalid on the input itself for assistive technologies.
  • Render FieldError immediately after the control or inside FieldContent to keep error messages aligned with the field.
<Field data-invalid="true">
    <FieldLabel for="email">Email</FieldLabel>
    <Input id="email" Type="email" aria-invalid="true" />
    <FieldError>Enter a valid email address.</FieldError>
</Field>

Accessibility

  • FieldSet and FieldLegend keep related controls grouped for keyboard and assistive tech users.
  • Field outputs role="group" so nested controls inherit labeling from FieldLabel and FieldLegend when combined.
  • Apply FieldSeparator sparingly to ensure screen readers encounter clear section boundaries.

RTL

To enable RTL support in Blazix, see the RTL configuration guide.

Translated with AI for the demo, so it may have mistakes.

طريقة الدفع

جميع المعاملات آمنة ومشفرة

أدخل رقم البطاقة المكون من 16 رقمًا

عنوان الفوترة

عنوان الفوترة المرتبط بطريقة الدفع الخاصة بك

<div class="w-full max-w-md">
    <form>
        <FieldGroup>

API Reference

Field

ParameterTypeDefault
Orientation FieldOrientation FieldOrientation.Vertical
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldContent

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldDescription

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldError

ParameterTypeDefault
Errors IEnumerable<string?>? -
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldGroup

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldLabel

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldLegend

ParameterTypeDefault
Variant FieldLegendVariant FieldLegendVariant.Legend
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldSeparator

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldSet

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.

FieldTitle

ParameterTypeDefault
Class string? -
ChildContent RenderFragment? -

Other attributes are passed to the element it renders.