BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/stackzero/variant-selector-images

variant-selector-images

stackzero/variant-selector-images
FreeComponent

stackzero publishes no description for this item.

Install it

npx shadcn@latest add https://ui.stackzero.co/r/variant-selector-images.json

Source

/components/commerce-ui/components/variant-selector/images/variant-selector-images.tsxui.stackzero.co/r/variant-selector-images.json
1"use client";
2
3import * as React from "react";
4import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
5import { Circle } from "lucide-react";
6
7import { cn } from "@/lib/utils";
8import Image from "next/image";
9
10export interface VariantItem {
11 id: string;
12 value: string;
13 label: string;
14 url: string;
15 disabled?: boolean;
16}
17
18interface VariantSelectorImagesProps {
19 value: string;
20 onValueChange: (value: string) => void;
21 variants: VariantItem[];
22 className?: string;
23}
24
25const VariantSelectorImages = ({
26 className,
27 onValueChange,
28 value,
29 variants,
30}: VariantSelectorImagesProps) => {
31 return (
32 <RadioGroupPrimitive.Root
33 className={cn("grid grid-cols-2 gap-2 sm:grid-cols-3", className)}
34 value={value}
35 onValueChange={onValueChange}
36 >
37 {variants.map((variant) => (
38 <label
39 key={variant.id}
40 className="border-input has-data-[state=checked]:border-ring has-data-[state=checked]:bg-accent has-focus-visible:outline-ring/70 relative flex cursor-pointer flex-col items-center gap-3 rounded-lg border px-2 py-3 text-center shadow-xs shadow-black/5 outline-offset-2 transition-colors has-focus-visible:outline has-data-disabled:cursor-not-allowed has-data-disabled:opacity-50"
41 >
42 <RadioGroupPrimitive.Item
43 value={variant.value}
44 disabled={variant.disabled}
45 className="sr-only after:absolute after:inset-0"
46 >
47 <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
48 <Circle className="h-2.5 w-2.5 fill-current text-current" />
49 </RadioGroupPrimitive.Indicator>
50 </RadioGroupPrimitive.Item>
51 <Image
52 alt={variant.label}
53 src={variant.url}
54 width={150}
55 height={150}
56 unoptimized
57 />
58 <p className="text-muted-foreground text-xs">{variant.label}</p>
59 </label>
60 ))}
61 </RadioGroupPrimitive.Root>
62 );
63};
64
65export default VariantSelectorImages;

What it pulls in

npm packages

  • lucide-react
  • @radix-ui/react-radio-group

Files it writes

  • @/components/commerce-ui/components/variant-selector/images/variant-selector-images.tsx

Facts

Registry
stackzero
Type
registry:component
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
today

Go to the source

ui.stackzero.co stackzero-labs/ui on GitHub Raw registry item This item as JSON

More from stackzero

All 112 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
face-rating-basicface-rating-basicstackzeroComponentsFree1 dep
face-rating-gradientface-rating-gradientstackzeroComponentsFree2 deps
image-carousel-basicimage-carousel-basicstackzeroComponentsFree5 deps
image-viewer-basicimage-viewer-basicstackzeroComponentsFree3 deps
image-viewer-basic-ex-01image-viewer-basic-ex-01stackzeroComponentsFree1 dep
image-viewer-basic-ex-02image-viewer-basic-ex-02stackzeroComponentsFree1 dep
image-viewer-motionimage-viewer-motionstackzeroComponentsFree4 deps
image-viewer-motion-ex-01image-viewer-motion-ex-01stackzeroComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex