Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Field examples · Layouts

Horizontal Layout Field for React

An input and a select, each with its label beside it.

Framework
UI library

A compact settings form where every label sits beside its control. Both Fields set orientation="horizontal": a Username input and a Language Select that opens on English. Stack more rows in the same FieldGroup for a preferences panel.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How do the labels sit beside the controls?

Both fields set orientation to horizontal inside one FieldGroup. Username is an Input, and Language is a Select, each with its FieldLabel first.

What does the username field accept?

type is text, and the placeholder is johndoe. FieldLabel names the input Username. Its htmlFor matches the control's id.

Which language is selected at first?

There is no placeholder, because a value is already selected. The items are English, Spanish, and French. Set defaultValue to en.

Where do the language options go?

Each language is a SelectItem. The trigger shows the selected label.

How wide is the pair of rows?

max-w-md on FieldGroup caps both rows. The label and the control share each row.

How do I stack these labels again?

Drop orientation on a Field, or set it to vertical. That field's label moves back above its control.