Form Grid

PreviousNext

Responsive field grid for dense form arrangements across phone, tablet, and desktop widths.

Shipping address

One column on small screens and compact multi-column composition above it.

import { FormGrid, FormGridItem } from "@/components/matos-ui/form-grid";
import { FormSection } from "@/components/matos-ui/form-section";
import { InputField } from "@/components/matos-ui/input";
import { TextareaField } from "@/components/matos-ui/textarea";

export function FormGridDemo() {
  return (
    <FormSection
      title="Shipping address"
      description="One column on small screens and compact multi-column composition above it."
      className="mx-auto w-full max-w-3xl"
    >
      <FormGrid columns="three" gap="compact">
        <InputField label="First name" placeholder="Ana" required />
        <InputField label="Last name" placeholder="Matos" required />
        <InputField label="Postal code" placeholder="00000-000" />
        <FormGridItem span="two">
          <InputField label="Street address" placeholder="Street and number" />
        </FormGridItem>
        <InputField label="City" placeholder="Sao Paulo" />
        <FormGridItem span="full">
          <TextareaField
            textareaSize="sm"
            label="Delivery notes"
            placeholder="Reception details or access instructions."
          />
        </FormGridItem>
      </FormGrid>
    </FormSection>
  );
}

Installation

pnpm dlx shadcn@latest add https://matos-ui.com/r/form-grid.json

Usage

import { FormGrid, FormGridItem } from "@/components/matos-ui/form-grid"

<FormGrid columns="three">
  <InputField label="City" />
  <InputField label="State" />
  <InputField label="Postal code" />
  <FormGridItem span="full">
    <TextareaField label="Notes" />
  </FormGridItem>
</FormGrid>

The grid begins as one column and expands with md and lg breakpoints. Available columns are one, two, and three.