Faber UI
Components

Field

A layout primitive for form fields.

Field is a layout primitive for composing form fields with labels, descriptions, and error messages.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/field.json

Usage

typescript
"use client";

import { Input } from "@/components/ui/input";
import { Field, FieldLabel } from "@/components/ui/field";

export default function Example() {
  return (
    <Field>
      <FieldLabel>Email</FieldLabel>
      <Input placeholder="you@example.com" />
    </Field>
  );
}

Examples

Default

We will never share your email.

With error

Horizontal

Field group

API

Each part forwards every prop of what it is built on, including className and render where Base UI supports it. The props column lists only what Faber UI adds on top.

PartBuilt onProps
FieldSetdata-slot="field-set"<fieldset>HTML—
FieldLegenddata-slot="field-legend"<legend>HTML
  • variant? = "legend""legend" | "label"
FieldGroupdata-slot="field-group"<div>HTML—
Fielddata-slot="field"<div>HTML
  • orientation? = "vertical""vertical" | "horizontal" | "responsive"
  • invalid?boolean
FieldContentdata-slot="field-content"<div>HTML—
FieldLabeldata-slot="field-label"LabelFaber UI—
FieldTitledata-slot="field-label"<div>HTML—
FieldDescriptiondata-slot="field-description"<p>HTML—
FieldSeparatordata-slot="field-separator"<div>HTML
  • children?React.ReactNode
FieldErrordata-slot="field-error"<div>HTML
  • errors?Array<{ message?: string } | undefined>

Changelog

  1. v0.1.0Accessibility, correctness, and token fixes across the kit, from a full code-smell audit.minor
Full Field history

Last updated on

On this page