Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Grid Layout Field for Svelte

Personal Details in a grid: First Name beside Last Name, then City across two columns and State in the remaining column.

UI library: Ark UI

Personal Details is the caption. First Name and Last Name share a row, placeholders John and Doe. City, placeholder New York, takes two columns. State, placeholder NY, takes one.

Save it for neighbors that should share a row, with one wider than the other. A loose frame around the same fields is a Card. Column sizes are not something Ark UI figures out on Svelte.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Field anatomy: root, label, input, description, error

Usage

<FieldSet class="w-full max-w-md"><FieldLegend variant="label">Personal Details</FieldLegend><FieldGroup><div class="grid grid-cols-2 gap-4"><Field><FieldLabel>First Name</FieldLabel><Input placeholder="John" type="text" /></Field><Field><FieldLabel>Last Name</FieldLabel><Input placeholder="Doe" type="text" /></Field></div><div class="grid grid-cols-3 gap-4"><Field class="col-span-2"><FieldLabel>City</FieldLabel><Input placeholder="New York" type="text" /></Field><Field><FieldLabel>State</FieldLabel><Input placeholder="NY" type="text" /></Field></div></FieldGroup></FieldSet>

FAQ

How are First Name and Last Name placed on one row?

They sit in a grid with grid-cols-2 and gap-4. Each cell is its own Field with a FieldLabel and an Input.

How does City take more room than State?

That row is a grid with grid-cols-3 and gap-4. City's Field has col-span-2, so State keeps the last column.

What is the Personal Details line?

FieldLegend with variant set to label is the caption on the FieldSet. label is the quieter legend. This set has no FieldDescription.

What do the inputs accept?

Every Input uses type text. The placeholders are John, Doe, New York, and NY.

How does each label connect?

FieldLabel names the input. Field connects the two for you, with no ids to write. The labels are First Name, Last Name, City, and State.

How wide is the set?

The set is capped with max-w-md. FieldGroup stacks the two grid rows under the legend.

API Reference

Field

Sets variant="label". The rest is on the Field page.

Input

Sets placeholder="John", type="text", placeholder="Doe", placeholder="New York" and placeholder="NY". The rest is on the Input page.