Componentform0.91 KB gzipZero dependencies
Field
Composable field primitives: Field, FieldLabel, FieldControl, FieldDescription, FieldError, FieldGroup, FieldSet.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add fieldOr install the full npm package:
npm install bigbulluiUsage
tsx8 lines
import { Field, FieldLabel, FieldControl, FieldDescription, FieldError } from "@/components/ui/field"; <Field> <FieldLabel htmlFor="name" required>Name</FieldLabel> <FieldControl><input id="name" /></FieldControl> <FieldDescription>Your full name.</FieldDescription> <FieldError>Please enter a name.</FieldError></Field>Source code
field.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxfield.tsx157 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export type FieldErrorProps = React.HTMLAttributes<HTMLParagraphElement> & { children?: React.ReactNode;}; export type FieldGroupProps = React.HTMLAttributes<HTMLDivElement> & { children?: React.ReactNode;}; export type FieldSetProps = React.FieldsetHTMLAttributes<HTMLFieldSetElement> & { legend?: React.ReactNode; children?: React.ReactNode;}; Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { FieldLabel } from "@/components/ui/field"; <FieldLabel />| Prop | Type | Description |
|---|---|---|
| fieldClassName | string | Configures field class name. |
| label | React.ReactNode | Label content. |
| htmlFor | string | Configures html for. |
| description | React.ReactNode | Helper text. |
| error | React.ReactNode | Error message. |
| required | boolean | Marks the field required. |
| children | React.ReactNode | Child elements rendered inside the component. |