variant-selector-basic-ex-04
stackzero/variant-selector-basic-ex-04FreeExample
stackzero publishes no description for this item.
Install it
npx shadcn@latest add https://ui.stackzero.co/r/variant-selector-basic-ex-04.jsonSource
1"use client";23import * as React from "react";4import VariantSelectorBasic, {5 VariantItem,6} from "@/components/commerce-ui/variant-selector-basic";78// Example size variants9const sizeVariants: VariantItem[] = [10 { id: "size-xs", label: "XS", value: "size-xs" },11 { id: "size-s", label: "S", value: "size-s" },12 { id: "size-m", label: "M", value: "size-m" },13 { id: "size-l", label: "L", value: "size-l" },14 { id: "size-xl", label: "XL", value: "size-xl" },15];1617export default function VariantSelector_Basic_Ex_04() {18 const [selectedSize, setSelectedSize] = React.useState("size-m");1920 return (21 <div className="space-y-8">22 <div className="space-y-4 rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-gray-900">23 <h3 className="text-lg font-semibold text-gray-900 dark:text-gray-100">24 Pill Style25 </h3>26 <p className="text-sm text-gray-600 dark:text-gray-400">27 Rounded pill-shaped variant buttons with custom active state using28 data-state29 </p>3031 <div className="space-y-2">32 <label className="text-sm font-medium text-gray-700 dark:text-gray-300">33 Select Size:34 </label>35 <VariantSelectorBasic36 value={selectedSize}37 onValueChange={setSelectedSize}38 variants={sizeVariants}39 className="gap-2"40 itemClassName="rounded-full min-w-[60px] bg-transparent hover:bg-gray-100 dark:hover:bg-gray-80041 data-[state=checked]:bg-gray-900 data-[state=checked]:border-gray-900 data-[state=checked]:text-white42 dark:data-[state=checked]:bg-white dark:data-[state=checked]:border-white dark:data-[state=checked]:text-gray-900"43 />44 </div>45 </div>46 </div>47 );48}
What it pulls in
npm packages
Other registry items
Files it writes
More from stackzero
All 112 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| address-02-block-exaddress-02-block-ex | stackzero | Examples | Free | 2 deps | |
| cart-01-block-excart-01-block-ex | stackzero | Examples | Free | 1 dep | |
| face-rating-basic-ex-01face-rating-basic-ex-01 | stackzero | Examples | Free | 1 dep | |
| face-rating-basic-ex-02face-rating-basic-ex-02 | stackzero | Examples | Free | 1 dep | |
| face-rating-basic-ex-03face-rating-basic-ex-03 | stackzero | Examples | Free | 1 dep | |
| face-rating-gradient-ex-01face-rating-gradient-ex-01 | stackzero | Examples | Free | 1 dep | |
| image-carousel-basic-ex-01image-carousel-basic-ex-01 | stackzero | Examples | Free | 1 dep | |
| image-carousel-basic-ex-02image-carousel-basic-ex-02 | stackzero | Examples | Free | 1 dep |
