{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "select-example", "title": "Select", "registryDependencies": [ "button", "dialog", "field", "input", "item", "native-select", "select", "example" ], "files": [ { "path": "registry/radix-sera/examples/select-example.tsx", "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport {\n Example,\n ExampleWrapper,\n} from \"@/registry/radix-sera/components/example\"\nimport { Button } from \"@/registry/radix-sera/ui/button\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/registry/radix-sera/ui/dialog\"\nimport {\n Field,\n FieldDescription,\n FieldError,\n FieldLabel,\n} from \"@/registry/radix-sera/ui/field\"\nimport { Input } from \"@/registry/radix-sera/ui/input\"\nimport {\n Item,\n ItemContent,\n ItemDescription,\n ItemTitle,\n} from \"@/registry/radix-sera/ui/item\"\nimport {\n NativeSelect,\n NativeSelectOption,\n} from \"@/registry/radix-sera/ui/native-select\"\nimport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"@/registry/radix-sera/ui/select\"\nimport { IconPlaceholder } from \"@/app/(create)/components/icon-placeholder\"\n\nexport default function SelectExample() {\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n )\n}\n\nfunction SelectBasic() {\n return (\n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n \n Grapes\n \n Pineapple\n \n \n \n \n )\n}\n\nfunction SelectWithIcons() {\n return (\n \n \n \n \n \n \n Chart Type\n >\n }\n />\n \n \n \n \n \n Line\n \n \n \n Bar\n \n \n \n Pie\n \n \n \n \n \n \n \n \n Chart Type\n >\n }\n />\n \n \n \n \n \n Line\n \n \n \n Bar\n \n \n \n Pie\n \n \n \n \n \n \n )\n}\n\nfunction SelectWithGroups() {\n return (\n \n \n \n \n \n \n \n Fruits\n Apple\n Banana\n Blueberry\n \n \n \n Vegetables\n Carrot\n Broccoli\n Spinach\n \n \n \n \n )\n}\n\nfunction SelectLargeList() {\n return (\n \n \n \n \n \n \n \n {Array.from({ length: 100 }).map((_, i) => (\n \n Item {i}\n \n ))}\n \n \n \n \n )\n}\n\nfunction SelectSizes() {\n return (\n \n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n \n \n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n \n \n \n \n \n )\n}\n\nfunction SelectWithButton() {\n return (\n \n \n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n \n \n \n \n Submit\n \n \n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n \n \n \n Submit\n \n \n \n )\n}\n\nfunction SelectItemAligned() {\n return (\n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n \n Grapes\n \n Pineapple\n \n \n \n \n )\n}\n\nfunction SelectWithField() {\n return (\n \n \n Favorite Fruit\n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n Grapes\n Pineapple\n \n \n \n \n Choose your favorite fruit from the list.\n \n \n \n )\n}\n\nfunction SelectInvalid() {\n return (\n \n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n Grapes\n Pineapple\n \n \n \n \n Favorite Fruit\n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n Grapes\n Pineapple\n \n \n \n \n \n \n \n )\n}\n\nfunction SelectInline() {\n return (\n \n \n \n \n \n \n \n \n \n All\n Active\n Inactive\n \n \n \n \n Sort by\n Name\n Date\n Status\n \n \n \n )\n}\n\nfunction SelectDisabled() {\n return (\n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n \n Grapes\n \n Pineapple\n \n \n \n \n )\n}\n\nconst plans = [\n {\n name: \"Starter\",\n description: \"Perfect for individuals getting started.\",\n },\n {\n name: \"Professional\",\n description: \"Ideal for growing teams and businesses.\",\n },\n {\n name: \"Enterprise\",\n description: \"Advanced features for large organizations.\",\n },\n]\n\nfunction SelectPlan() {\n const [plan, setPlan] = React.useState(plans[0].name)\n\n const selectedPlan = plans.find((p) => p.name === plan)\n\n return (\n \n \n \n \n {selectedPlan && }\n \n \n \n \n {plans.map((plan) => (\n \n \n \n ))}\n \n \n \n \n )\n}\n\nfunction SelectPlanItem({ plan }: { plan: (typeof plans)[number] }) {\n return (\n \n \n {plan.name}\n \n {plan.description}\n \n \n \n )\n}\n\nfunction SelectInDialog() {\n return (\n \n \n \n Open Dialog\n \n \n \n Select Example\n \n Use the select below to choose a fruit.\n \n \n \n \n \n \n \n \n Apple\n Banana\n Blueberry\n Grapes\n Pineapple\n \n \n \n \n \n \n )\n}\n", "type": "registry:example" } ], "type": "registry:example" }