select
shadcn-solidjs/selectFreeComponent
shadcn-solidjs publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn-solidjs on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-solidjs.com/r/select.jsonSource
1import type { PolymorphicProps } from "@kobalte/core/polymorphic";2import * as SelectPrimitive from "@kobalte/core/select";34import { cn } from "~/lib/utils.ts";56import IconCheck from "~icons/lucide/check";7import IconChevronDown from "~icons/lucide/chevron-down";8import type { Component, ComponentProps, JSX, ValidComponent } from "solid-js";9import { mergeProps, splitProps } from "solid-js";1011// Unlike radix, Kobalte's Root renders a real <div> wrapping the12// trigger, so the slot marks the element grouped containers (e.g.13// button-group) match on.14const Select = <Option, OptGroup = never, T extends ValidComponent = "div">(15 props: PolymorphicProps<16 T,17 SelectPrimitive.SelectRootProps<Option, OptGroup, T>18 >,19) => (20 <SelectPrimitive.Root21 data-slot="select"22 {...(props as SelectPrimitive.SelectRootProps<Option, OptGroup>)}23 />24);2526const SelectHiddenSelect = SelectPrimitive.HiddenSelect;2728type SelectValueProps<Option, T extends ValidComponent = "span"> =29 SelectPrimitive.SelectValueProps<Option, T>;3031const SelectValue = <Option, T extends ValidComponent = "span">(32 props: PolymorphicProps<T, SelectValueProps<Option, T>>,33) => (34 <SelectPrimitive.Value35 data-slot="select-value"36 {...(props as SelectValueProps<Option>)}37 />38);3940type SelectTriggerProps<T extends ValidComponent = "button"> =41 & SelectPrimitive.SelectTriggerProps<T>42 & {43 class?: string | undefined;44 children?: JSX.Element;45 size?: "sm" | "default";46 };4748const SelectTrigger = <T extends ValidComponent = "button">(49 rawProps: PolymorphicProps<T, SelectTriggerProps<T>>,50) => {51 const props = mergeProps(52 { size: "default" as const },53 rawProps as SelectTriggerProps,54 );55 const [local, others] = splitProps(props, ["class", "children", "size"]);56 return (57 <SelectPrimitive.Trigger58 data-slot="select-trigger"59 data-size={local.size}60 class={cn(61// … truncated
What it pulls in
npm packages
More from shadcn-solidjs
All 85 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn-solidjs | Components | Free | 1 dep | |
| alertalert | shadcn-solidjs | Components | Free | 2 deps | |
| alert-dialogalert-dialog | shadcn-solidjs | Components | Free | 2 deps | |
| aspect-ratioaspect-ratio | shadcn-solidjs | Components | Free | no deps | |
| attachmentattachment | shadcn-solidjs | Components | Free | 2 deps | |
| avataravatar | shadcn-solidjs | Components | Free | 1 dep | |
| badgebadge | shadcn-solidjs | Components | Free | 2 deps | |
| breadcrumbbreadcrumb | shadcn-solidjs | Components | Free | 1 dep |
