"use client" import { Example, ExampleWrapper, } from "@/registry/bases/base/components/example" import { Button } from "@/registry/bases/base/ui/button" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/registry/bases/base/ui/dialog" import { Field, FieldDescription, FieldError, FieldLabel, } from "@/registry/bases/base/ui/field" import { Input } from "@/registry/bases/base/ui/input" import { Item, ItemContent, ItemDescription, ItemTitle, } from "@/registry/bases/base/ui/item" import { NativeSelect, NativeSelectOption, } from "@/registry/bases/base/ui/native-select" import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, } from "@/registry/bases/base/ui/select" import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder" export default function SelectExample() { return ( ) } function SelectBasic() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, { label: "Grapes", value: "grapes" }, { label: "Pineapple", value: "pineapple" }, ] return ( {items.map((item) => ( {item.label} ))} ) } function SelectWithIcons() { const items = [ { label: ( <> Chart Type > ), value: null, }, { label: ( <> Line > ), value: "line", }, { label: ( <> Bar > ), value: "bar", }, { label: ( <> Pie > ), value: "pie", }, ] return ( {items.map((item) => ( {item.label} ))} {items.map((item) => ( {item.label} ))} ) } function SelectWithGroups() { const fruits = [ { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, ] const vegetables = [ { label: "Carrot", value: "carrot" }, { label: "Broccoli", value: "broccoli" }, { label: "Spinach", value: "spinach" }, ] const allItems = [ { label: "Select a fruit", value: null }, ...fruits, ...vegetables, ] return ( Fruits {fruits.map((item) => ( {item.label} ))} Vegetables {vegetables.map((item) => ( {item.label} ))} ) } function SelectLargeList() { const items = [ { label: "Select an item", value: null }, ...Array.from({ length: 100 }).map((_, i) => ({ label: `Item ${i}`, value: `item-${i}`, })), ] return ( {items.map((item) => ( {item.label} ))} ) } function SelectSizes() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, ] return ( {items.map((item) => ( {item.label} ))} {items.map((item) => ( {item.label} ))} ) } function SelectWithButton() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, ] return ( {items.map((item) => ( {item.label} ))} Submit {items.map((item) => ( {item.label} ))} Submit ) } function SelectItemAligned() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, { label: "Grapes", value: "grapes", disabled: true }, { label: "Pineapple", value: "pineapple" }, ] return ( {items.map((item) => ( {item.label} ))} ) } function SelectWithField() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, { label: "Grapes", value: "grapes" }, { label: "Pineapple", value: "pineapple" }, ] return ( Favorite Fruit {items.map((item) => ( {item.label} ))} Choose your favorite fruit from the list. ) } function SelectInvalid() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, { label: "Grapes", value: "grapes" }, { label: "Pineapple", value: "pineapple" }, ] return ( {items.map((item) => ( {item.label} ))} Favorite Fruit {items.map((item) => ( {item.label} ))} ) } function SelectInline() { const items = [ { label: "Filter", value: null }, { label: "All", value: "all" }, { label: "Active", value: "active" }, { label: "Inactive", value: "inactive" }, ] return ( {items.map((item) => ( {item.label} ))} Sort by Name Date Status ) } function SelectDisabled() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, { label: "Grapes", value: "grapes", disabled: true }, { label: "Pineapple", value: "pineapple" }, ] return ( {items.map((item) => ( {item.label} ))} ) } const plans = [ { name: "Starter", description: "Perfect for individuals getting started.", }, { name: "Professional", description: "Ideal for growing teams and businesses.", }, { name: "Enterprise", description: "Advanced features for large organizations.", }, ] function SelectPlan() { return ( plan.name} > {(value: (typeof plans)[number]) => } {plans.map((plan) => ( ))} ) } function SelectPlanItem({ plan }: { plan: (typeof plans)[number] }) { return ( {plan.name} {plan.description} ) } function SelectMultiple() { const items = [ { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, { label: "Grapes", value: "grapes" }, { label: "Pineapple", value: "pineapple" }, { label: "Strawberry", value: "strawberry" }, { label: "Watermelon", value: "watermelon" }, ] return ( {(value: string[]) => { if (value.length === 0) { return "Select fruits" } if (value.length === 1) { return items.find((item) => item.value === value[0])?.label } return `${value.length} fruits selected` }} {items.map((item) => ( {item.label} ))} ) } function SelectInDialog() { const items = [ { label: "Select a fruit", value: null }, { label: "Apple", value: "apple" }, { label: "Banana", value: "banana" }, { label: "Blueberry", value: "blueberry" }, { label: "Grapes", value: "grapes" }, { label: "Pineapple", value: "pineapple" }, ] return ( }> Open Dialog Select Example Use the select below to choose a fruit. {items.map((item) => ( {item.label} ))} ) }