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-02-block

product-variant-02-block

stackzero/product-variant-02-block
FreeBlock

stackzero publishes no description for this item.

Install it

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

Source

/components/commerce-ui/blocks/product-variants/product-variants-02.tsxui.stackzero.co/r/product-variant-02-block.json · first 6 KB
1"use client";
2
3import ImageViewer from "@/components/commerce-ui/image-viewer-basic";
4import PriceFormat_Sale from "@/components/commerce-ui/price-format-sale";
5import QuantityInputBasic from "@/components/commerce-ui/quantity-input-basic";
6import VariantSelectorBasic, {
7 VariantItem as BaseVariantItem,
8} from "@/components/commerce-ui/variant-selector-basic";
9import { Button } from "@/components/ui/button";
10import { Separator } from "@/components/ui/separator";
11import { Clock } from "lucide-react";
12import Link from "next/link";
13import { useState } from "react";
14
15interface VariantItem extends BaseVariantItem {
16 price: number;
17 salePrice?: number;
18 imageUrl?: string;
19 isInStock?: boolean; // Added stock status per variant
20 availableQuantity?: number | null; // Added quantity per variant
21}
22
23interface VariantSelectionPayload {
24 variantId: string;
25 variantLabel: string;
26 quantity: number;
27 price: number;
28 originalPrice?: number;
29 salePrice?: number;
30 totalPrice: number;
31 isOnSale: boolean;
32}
33
34interface ProductVariant02Props {
35 title?: string;
36 description?: string;
37 badge?: string | null;
38 shippingInfo?: string;
39 variants: VariantItem[];
40 defaultImage?: string;
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 sellerName?: string;
52 marketplaceName?: string;
53 returnPolicyUrl?: string;
54}
55
56function ProductVariant_02({
57 badge = "New",
58 defaultImage,
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 marketplaceName = "Lorem Marketplace",
64 onAddToCart = () => {},
65 onBuyNow = () => {},
66 onQuantityChange,
67 onVariantChange,
68 quantity: controlledQuantity,
69 returnPolicyUrl = "/",
70 selectedVariant: controlledVariant,
71 sellerName = "Seller Name",
72 shippingInfo = "Free shipping",
73 title = "Product Variant Title",
74 variantLabel = "Variant",
75 variants = [],
76}: ProductVariant02Props) {
77 // Ensure variants array is not empty
78 if (!variants.length) {
79 throw new Error("At least one variant must be provided");
80 }
81
82// … truncated

What it pulls in

npm packages

  • lucide-react

Other registry items

  • button
  • badge
  • separator
  • https://ui.stackzero.co/r/image-viewer-basic.json
  • https://ui.stackzero.co/r/price-format-sale.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-02.tsx

Facts

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

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