Select

Displays a list of options for the user to pick from—triggered by a button.

Installation

npx shadcn@latest add https://spoke.georgedrury.co.uk/r/select

Lineage

Anatomy

import {
	Select,
	SelectTrigger,
	SelectValue,
	SelectContent,
	SelectItem,
} from "@/components/ui/select"

export default () => (
	<Select>
		<SelectTrigger>
			<SelectValue />
		</SelectTrigger>
		<SelectContent>
			<SelectItem />
		</SelectContent>
	</Select>
)

Spoke utility classes

ClassFallback chainDescription
--select-radiusvar(--input-radius, var(--radius-md))Border radius for select
--select-bordervar(--input-border, var(--input))Border colour for select
--select-backgroundvar(--input-background, transparent)Background colour for select
--shadow-selectvar(--input-shadow, var(--shadow-xs))Box shadow for select
--select-content-radiusvar(--radius-md)Border radius for content
--select-contentvar(--popover)Colour for content select variant
--select-content-foregroundvar(--popover-foreground)Text/icon colour for content select variant
--select-item-focusvar(--accent)Colour for item focus select variant
--select-item-focus-foregroundvar(--accent-foreground)Text/icon colour for item focus select variant