select
shadcn/selectFreeComponent
shadcn publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add selectSource
1"use client"23import * as React from "react"4import * as SelectPrimitive from "@radix-ui/react-select"5import { Check, ChevronDown, ChevronUp } from "lucide-react"67import { cn } from "@/lib/utils"89const Select = SelectPrimitive.Root1011const SelectGroup = SelectPrimitive.Group1213const SelectValue = SelectPrimitive.Value1415const SelectTrigger = React.forwardRef<16 React.ElementRef<typeof SelectPrimitive.Trigger>,17 React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>18>(({ className, children, ...props }, ref) => (19 <SelectPrimitive.Trigger20 ref={ref}21 className={cn(22 "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",23 className24 )}25 {...props}26 >27 {children}28 <SelectPrimitive.Icon asChild>29 <ChevronDown className="h-4 w-4 opacity-50" />30 </SelectPrimitive.Icon>31 </SelectPrimitive.Trigger>32))33SelectTrigger.displayName = SelectPrimitive.Trigger.displayName3435const SelectScrollUpButton = React.forwardRef<36 React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,37 React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>38>(({ className, ...props }, ref) => (39 <SelectPrimitive.ScrollUpButton40 ref={ref}41 className={cn(42 "flex cursor-default items-center justify-center py-1",43 className44 )}45 {...props}46 >47 <ChevronUp className="h-4 w-4" />48 </SelectPrimitive.ScrollUpButton>49))50SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName5152const SelectScrollDownButton = React.forwardRef<53 React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,54 React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>55>(({ className, ...props }, ref) => (56 <SelectPrimitive.ScrollDownButton57 ref={ref}58 className={cn(59 "flex cursor-default items-center justify-center py-1",60 className61 )}62 {...props}63 >64 <ChevronDown className="h-4 w-4" />65 </SelectPrimitive.ScrollDownButton>66))67SelectScrollDownButton.displayName =68 SelectPrimitive.ScrollDownButton.displayName6970const SelectContent = React.forwardRef<71 React.ElementRef<typeof SelectPrimitive.Content>,72 React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>73// … truncated
Files it writes
More from shadcn
All 62 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn | Components | Free | no deps | |
| alertalert | shadcn | Components | Free | no deps | |
| alert-dialogalert-dialog | shadcn | Components | Free | no deps | |
| aspect-ratioaspect-ratio | shadcn | Components | Free | no deps | |
| attachmentattachment | shadcn | Components | Free | no deps | |
| avataravatar | shadcn | Components | Free | no deps | |
| badgebadge | shadcn | Components | Free | no deps | |
| breadcrumbbreadcrumb | shadcn | Components | Free | no deps |
