Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Field

    The layout of a form: a label, a control, a description and an error, stacked or in a row, grouped into fieldsets. Drop-in for shadcn's Field. Nelumbo text fields keep their floating label, and checkbox, radio and switch rows can become selectable cards.

    Install

    npx shadcn@latest add @nelumbo/field

    Payment form

    FieldSet and FieldLegend name a group, FieldGroup spaces the fields. A FieldLabel beside a Nelumbo Input or Select becomes its floating label, so nothing is drawn twice, while the id, aria-invalid and aria-describedby are wired for you.

    Payment method

    All transactions are secure and encrypted.

    Enter your 16 digit card number.

    Billing address

    The address that matches your card.

    Choice cards

    A FieldLabel that wraps a Field is a card. The whole card is the target for its radio, checkbox or switch; selecting it fills it with the secondary color and its corners spring from round to squarer.

    Plan

    Radio cards: one choice.

    Notify me

    Checkbox and switch cards.

    Horizontal

    orientation="horizontal" puts the control beside its text, for settings rows. A FieldContent holds the title and description; a switch centers on the row, a checkbox lines up with the first line.

    Privacy

    People can find you by your email address.

    Show when you have seen a message.

    Managed by your organization.

    Helps us find what to fix first.

    Responsive

    orientation="responsive" stacks until its FieldGroup is 28rem wide (a container query, not the window), then sits in a row. Drag the right edge of the frame to try it.

    Shown on your public profile.

    or

    A line or two.

    Errors

    Put data-invalid on the Field: the label, the control and a choice card turn red and the Nelumbo field gets aria-invalid. FieldError is always mounted, so screen readers hear it, and it opens with a spring. Give it an errors array (react-hook-form, Zod; duplicates are merged) or children.

    We send the receipt here.

    Enter a full address, like name@example.com.
    • At least 8 characters.
    • Add a number.

    Separator

    FieldSeparator is spacing, not a line. With text, the text sits centered in the gap.

    Or continue with

    Usage

    import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "@/components/ui/field"​<FieldSet>  <FieldLegend>Account</FieldLegend>  <FieldGroup>    <Field data-invalid={!!errors.email}>      <FieldLabel htmlFor="email">Email</FieldLabel>   {/* becomes the Input's floating label */}      <Input id="email" type="email" />      <FieldDescription>We send the receipt here.</FieldDescription>      <FieldError errors={[errors.email]} />    </Field>​    {/* a choice card */}    <FieldLabel htmlFor="news">      <Field orientation="horizontal">        <FieldContent>          <FieldTitle>Newsletter</FieldTitle>          <FieldDescription>One email a month.</FieldDescription>        </FieldContent>        <Checkbox id="news" />      </Field>    </FieldLabel>  </FieldGroup></FieldSet>

    Props

    PropTypeDefaultNotes
    Field orientation"vertical" | "horizontal" | "responsive""vertical"Responsive switches at 28rem of the enclosing FieldGroup.
    Field data-invalidbooleanfalseRed label, aria-invalid on a Nelumbo field, error state on cards.
    Field data-disabledbooleanfalseDims the label and description.
    Field floatingbooleantruefalse keeps a separate FieldLabel beside a Nelumbo text field.
    FieldLabelLabel propsWrapping a Field makes it a choice card. Beside a Nelumbo text field with a string child, it becomes that field's label.
    FieldError errorsArray<{ message?: string }>Deduplicated; several messages become a list. Or pass children.
    FieldLegend variant"legend" | "label""legend"Legend is a title, label is a small label.
    FieldSeparatordiv propsSpacing; children are centered text. No line.
    FieldGroup / FieldSet / FieldContent / FieldTitle / FieldDescriptionLayout parts; same as shadcn.