codefast/ui

Command Palette

Search for a command to run...

Form

Field

Layout wrapper that composes label, description, error, and control in vertical or horizontal orientation.

Install

pnpm add @codefast/ui

Import path

@codefast/ui/field

Examples

Checkbox

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

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.

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.

Fieldset

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

Address Information

We need your address to deliver your order.

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

Input

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

Choose a unique username for your account.

Must be at least 8 characters long.

Radio

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

Subscription Plan

Yearly and lifetime plans offer significant savings.

Responsive Layout

Field layouts adapt responsively to their container.

Profile

Fill in your profile information.

Provide your full name for identification

RTL

Right-to-left layout support for languages such as Arabic and Hebrew.

Translations are AI-generated for demonstration and may be imperfect.

طريقة الدفع

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

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

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

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

Select

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

Select your department or area of work.

Slider

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

Price Range

Set your budget range ($200 - 800).

Switch

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

Textarea

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

Share your thoughts about our service.

Anatomy

How the parts compose. Copy this skeleton and fill in the slots.

import {
  Field, FieldLabel, FieldDescription, FieldError,
} from "@codefast/ui/field";

<Field>
  <FieldLabel htmlFor="email">Email</FieldLabel>
  <Input id="email" aria-invalid={invalid} />
  <FieldDescription>Helper text</FieldDescription>
  {invalid && <FieldError>Required.</FieldError>}
</Field>

API reference

Props for each part of the component. All native element props are also forwarded.

Field

Vertical wrapper that lays out a label, control, description, and error.

PropTypeDefaultDescription
orientation"vertical" | "horizontal""vertical"Stack the control under the label, or beside it.

FieldLabel / FieldDescription / FieldError

The text parts. Render FieldError conditionally when the field is invalid.

PropTypeDefaultDescription
htmlForstringOn FieldLabel, points at the control id for an accessible name.

FieldSet / FieldLegend / FieldGroup

Group several related fields under a legend.

PropTypeDefaultDescription
childrenReactNodeFieldLegend titles the set; FieldGroup spaces fields evenly.

Accessibility

Built to be keyboard-navigable and screen-reader friendly out of the box.

  • FieldLabel forwards htmlFor — always link it to the control’s id.
  • Set aria-invalid on the control and render FieldError so the error is announced.
  • Use FieldSet + FieldLegend for groups of checkboxes or radios.

Guidelines

Conventions that keep usage consistent across an app.

Do

  • Pair every control with a FieldLabel.
  • Show errors next to the field, on submit or on blur — not only as a toast.

Don’t

  • Don’t rely on the red ring alone — always give a text error.
  • Don’t use placeholder text as the label.