Field

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

Payment Method

All transactions are secure and encrypted

Enter your 16-digit card number

Billing Address

The billing address associated with your payment method

Usage

Field uses semantic HTML with minimal classes. Two main patterns can be used independently or composed together:

  • <div role="group" class="field"> for individual field containers (label, input, helper text, errors)
  • <fieldset class="fieldset"> for grouping multiple related fields together

Elements inside these containers are styled automatically based on their purpose. Use aria-describedby to connect helper text and errors to inputs for accessibility.

Fields have the following HTML structure:

<div role="group" class="field">
Field container. Add data-orientation="horizontal" to align controls horizontally. For responsive layouts, use standard Tailwind responsive classes.
<label>
Label for the input.
<input>, <select> or <textarea>
Form input.
<p> Optional
Helper text. Use aria-describedby on the input to reference this element's id.
<p role="alert"> Optional
Error message. Use aria-describedby on the input and aria-invalid="true" to reference this element's id.
<section> Optional
Wraps label and description when the label sits beside the input (e.g. data-orientation="horizontal"). Not required if you have no description.

Fieldsets have the following HTML structure:

<fieldset class="fieldset">
Container for grouping related fields.
<legend>
Heading for the fieldset.
<p> Optional
Description text. When placed directly after <legend>, automatically styled as muted text.
<div role="group" class="field"> Optional
Individual field containers (see structure above). You can include multiple .field elements, or place form controls directly in the fieldset.

Examples

Input

Choose a unique username for your account.

Must be at least 8 characters long.

Textarea

Share your thoughts about our service.

Select

Select your department or area of work.

Slider

Set your budget: $150

Fieldset

Group related fields with <fieldset class="fieldset"> and <legend>.

Profile

This information will be displayed on your profile

Your first and last name

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.

Radio Group

Subscription plan

Yearly and lifetime plans offer significant savings.

Switch

Set data-orientation="horizontal" on .field to align labels and controls side-by-side.

Enable multi-factor authentication. If you do not have a two-factor device, you can use a one-time code sent to your email.

Choice Card

Compute Environment

Select the compute environment for your cluster.

Responsive Layout

For responsive layouts, use standard Tailwind responsive classes directly on .field. This example stacks vertically on mobile and switches to horizontal at the md breakpoint.

Profile

Keep your profile details up to date.


Provide your full name for identification.


You can write your message here. Keep it short, preferably under 100 characters.