UI catalog · Tokens · 日本語 These examples do not call the service. Model rendering is a static placeholder.
Source commit: d204666f04a0ee7b6f18543f8aec414b4128874e · shadcn build 4.23.1
Noto Sans JP · @fontsource/noto-sans-jp 5.3.1 · OFL-1.1
Preview Install (publication pending) These URLs are planned for publication and are not available yet. Inspect existing file differences before installing; do not use --overwrite by default.
npx shadcn@latest add https://spritestack.dev/r/spst-select.jsonAdd to registries in components.json
{"registries":{"@spritestack":"https://spritestack.dev/r/{name}.json"}}npx shadcn@latest add @spritestack/spst-selectTargets React 19, Tailwind v4 and shadcn projects with src/. Layouts without src/ are unverified. Installation copies source files; updates are not automatic.
import "./styles/spritestack/theme.css";
<div className="spst-theme" data-theme="light">
{/* Render components here. */}
</div>Pass an element inside .spst-theme to container / portalContainer for portals. Self-host Noto Sans JP weights 400, 600 and 700 in your application; system-ui is the fallback.
Dependencies Props / API Generated by parsing the actual source. Rows marked … reference inherited React / Radix public types. — means no default is declared in this function parameter. See the type declarations for union-specific requirements.
src/components/ui/select.tsxSelect Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>)SelectGroup SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>)SelectValue SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>)SelectTrigger SelectTrigger({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Trigger>)SelectContent SelectContent({
className,
children,
container,
position = "item-aligned",
align = "center",
...props
}: React.ComponentProps<typeof SelectPrimitive.Content> &
Pick<React.ComponentProps<typeof SelectPrimitive.Portal>, "container">)Destructuring defaults (including inherited props) position = "item-aligned"
align = "center"SelectLabel SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>)SelectItem SelectItem({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Item>)SelectSeparator SelectSeparator({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.Separator>)SelectScrollUpButton SelectScrollUpButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>)SelectScrollDownButton SelectScrollDownButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>)Inspect type declarations and source // 出典: shadcn/ui new-york-v4/select(commit c1ead5c92572ce6e95dc7bb3221feaf2b3aa59a7、MIT)。
"use client";
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
import { Select as SelectPrimitive } from "radix-ui";
import type * as React from "react";
import { cn } from "../../lib/spritestack/utils";
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
return <SelectPrimitive.Root data-slot="select" {...props} />;
}
function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
}
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
}
function SelectTrigger({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Trigger>) {
return (
<SelectPrimitive.Trigger
data-slot="select-trigger"
className={cn(
"flex w-fit items-center justify-between gap-2 rounded-input border border-input bg-card px-3 py-2 text-foreground enabled:hover:bg-accent aria-invalid:border-destructive-foreground aria-invalid:bg-destructive aria-invalid:enabled:hover:bg-destructive aria-invalid:text-destructive-foreground aria-invalid:data-[placeholder]:text-destructive-foreground data-[placeholder]:text-muted-foreground font-sans text-sm font-(weight:--spst-font-weight-control) outline-none focus-visible:outline-solid focus-visible:outline-(length:--spst-focus-width) focus-visible:outline-ring focus-visible:outline-offset-(--spst-focus-offset) disabled:cursor-not-allowed",
className,
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDownIcon aria-hidden="true" className="size-4" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
);
}
function SelectContent({
className,
children,
container,
position = "item-aligned",
align = "center",
...props
}: React.ComponentProps<typeof SelectPrimitive.Content> &
Pick<React.ComponentProps<typeof SelectPrimitive.Portal>, "container">) {
return (
<SelectPrimitive.Portal container={container}>
<SelectPrimitive.Content
data-slot="select-content"
className={cn(
"relative z-50 max-h-(--radix-select-content-available-height) overflow-x-hidden overflow-y-auto rounded-card border border-input bg-popover text-popover-foreground shadow-popover font-sans",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className,
)}
position={position}
align={align}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
"p-1",
position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
);
}
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
return (
<SelectPrimitive.Label
data-slot="select-label"
className={cn("px-2 py-1 text-sm text-muted-foreground", className)}
{...props}
/>
);
}
function SelectItem({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
return (
<SelectPrimitive.Item
data-slot="select-item"
className={cn(
"relative flex w-full cursor-default items-center gap-2 rounded-input py-2 pr-6 pl-2 text-sm text-foreground select-none focus:bg-accent data-[state=checked]:bg-accent data-[state=checked]:inset-ring data-[state=checked]:inset-ring-ring data-[disabled]:cursor-not-allowed outline-none focus-visible:outline-solid focus-visible:outline-(length:--spst-focus-width) focus-visible:outline-ring focus-visible:outline-offset-(--spst-focus-offset)",
className,
)}
{...props}
>
<span
data-slot="select-item-indicator"
className="absolute right-2 flex size-4 items-center justify-center"
>
<SelectPrimitive.ItemIndicator>
<CheckIcon aria-hidden="true" className="size-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
);
}
function SelectSeparator({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
return (
<SelectPrimitive.Separator
data-slot="select-separator"
className={cn("pointer-events-none -mx-1 my-1 border-t border-border", className)}
{...props}
/>
);
}
function SelectScrollUpButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
return (
<SelectPrimitive.ScrollUpButton
data-slot="select-scroll-up-button"
className={cn("flex cursor-default items-center justify-center py-1", className)}
{...props}
>
<ChevronUpIcon aria-hidden="true" className="size-4" />
</SelectPrimitive.ScrollUpButton>
);
}
function SelectScrollDownButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
return (
<SelectPrimitive.ScrollDownButton
data-slot="select-scroll-down-button"
className={cn("flex cursor-default items-center justify-center py-1", className)}
{...props}
>
<ChevronDownIcon aria-hidden="true" className="size-4" />
</SelectPrimitive.ScrollDownButton>
);
}
export {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectScrollDownButton,
SelectScrollUpButton,
SelectSeparator,
SelectTrigger,
SelectValue,
};
Accessibility requirements Give inputs a label or accessible name and associate errors with aria-describedby. Do not communicate state using color alone. Provide model names and image fallbacks. Icon-only buttons need accessible names. Provide dialog and sheet titles and descriptions, and place portals inside the theme. Test Tab, arrow keys, Escape and focus restoration in the consuming app. Slider requires a name and finite min < max. ToggleGroup requires a nonempty single value. The parent controls pending state. Reference images: 09・10 · Dark mode and error states extend the reference design.