BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/stackzero/product-variant-03-block

product-variant-03-block

stackzero/product-variant-03-block
FreeBlock

stackzero publishes no description for this item.

Install it

npx shadcn@latest add https://ui.stackzero.co/r/product-variant-03-block.json

Source

/components/commerce-ui/blocks/product-variants/product-variants-03.tsxui.stackzero.co/r/product-variant-03-block.json · first 6 KB
1"use client";
2
3import ImageCarousel_Basic, {
4 CarouselImage,
5} from "@/components/commerce-ui/image-carousel-basic";
6import PriceFormat from "@/components/commerce-ui/price-format-basic";
7import QuantityInputBasic from "@/components/commerce-ui/quantity-input-basic";
8import VariantSelectorBasic, {
9 VariantItem as BaseVariantItem,
10} from "@/components/commerce-ui/variant-selector-basic";
11import { Button } from "@/components/ui/button";
12import { Separator } from "@/components/ui/separator";
13import { Check, ShieldCheck } from "lucide-react";
14import { useState } from "react";
15
16interface VariantItem extends BaseVariantItem {
17 price: number;
18 salePrice?: number;
19 images?: CarouselImage[];
20 isInStock?: boolean;
21 availableQuantity?: number | null;
22 features?: string[];
23}
24
25interface VariantSelectionPayload {
26 variantId: string;
27 variantLabel: string;
28 quantity: number;
29 price: number;
30 salePrice?: number;
31 totalPrice: number;
32 isOnSale: boolean;
33}
34
35interface ProductVariant03Props {
36 title?: string;
37 description?: string;
38 badge?: string | null;
39 variants: VariantItem[];
40 defaultImages?: CarouselImage[];
41 initialVariant?: string;
42 variantLabel?: string;
43 onAddToCart?: (payload: VariantSelectionPayload) => void;
44 onBuyNow?: (payload: VariantSelectionPayload) => void;
45 selectedVariant?: string;
46 onVariantChange?: (variant: string) => void;
47 quantity?: number;
48 onQuantityChange?: (quantity: number) => void;
49 isLoading?: boolean;
50 errorMessage?: string | null;
51 currencyPrefix?: string;
52 releaseDate?: string;
53}
54
55function ProductVariant_03({
56 badge = "Just Released",
57 currencyPrefix = "$",
58 defaultImages = [],
59 description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
60 errorMessage = null,
61 initialVariant,
62 isLoading = false,
63 onAddToCart = () => {},
64 onBuyNow = () => {},
65 onQuantityChange,
66 onVariantChange,
67 quantity: controlledQuantity,
68 releaseDate = "August 15, 2023",
69 selectedVariant: controlledVariant,
70 title = "Product Variant Title",
71 variantLabel = "Model",
72 variants = [],
73}: ProductVariant03Props) {
74 // Ensure variants array is not empty
75 if (!variants.length) {
76 throw new Error("At least one variant must be provided");
77 }
78
79 const defaultInitialVariant = initialVariant || variants[0].value;
80
81 const [internalSelectedVariant, setInternalSelectedVariant] = useState(
82 defaultInitialVariant
83 );
84// … truncated

What it pulls in

npm packages

  • lucide-react

Other registry items

  • button
  • separator
  • https://ui.stackzero.co/r/image-carousel-basic.json
  • https://ui.stackzero.co/r/price-format-basic.json
  • https://ui.stackzero.co/r/variant-selector-basic.json
  • https://ui.stackzero.co/r/quantity-input-basic.json

Files it writes

  • @/components/commerce-ui/blocks/product-variants/product-variants-03.tsx

Facts

Registry
stackzero
Type
registry:block
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
address-01-blockaddress-01-blockstackzeroBlocksFree4 deps
address-02-blockaddress-02-blockstackzeroBlocksFree4 deps
address-03-blockaddress-03-blockstackzeroBlocksFree4 deps
banner-01-blockbanner-01-blockstackzeroBlocksFreeno deps
banner-02-blockbanner-02-blockstackzeroBlocksFreeno deps
banner-03-blockbanner-03-blockstackzeroBlocksFreeno deps
banner-04-blockbanner-04-blockstackzeroBlocksFreeno deps
banner-05-blockbanner-05-blockstackzeroBlocksFreeno deps
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