compacto-ui

Search documentation

Jump to a page or a component.

Select

The same box as Input, so fields and selects read as one family.

Preview

Installation

No install — ask an AI agent to copy this component from registry.json.

import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "@/components/ui/select";

Notes

  • SelectLabel throws unless it is inside a SelectGroup — Radix reads the group's context to wire the label to its items. Nothing in the types says so.
  • The trigger is deliberately the same box as the Input recipe, so a select and a text field in one form read as a family.
  • position="item-aligned" (the default) lines the selected item up over the trigger like a native select. Switch to "popper" when the list is long enough that alignment would push it off-screen.

Props

The props worth knowing. Everything else passes straight through to the underlying element, including className, which is merged last so it always wins.

PropTypeDefaultDescription
size (SelectTrigger)"default" | "sm""default"36px or 32px, the latter for dense toolbars.
position (SelectContent)"item-aligned" | "popper""item-aligned"How the open list anchors.