Select preview

Interactive preview of the CyberSpec Select component. A labelled trigger that opens a list of options to choose from.

About this preview

Select belongs to the Pickers group in the CyberSpec catalog. It uses @ui-sdk/react/select, @ui-sdk/react/field.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/select.json

Example

"use client"

import { Select } from "@/components/ui/select"

export default function SelectDemo() {
  return (
    <>
      <Select
        label="District"
        defaultValue="glasswater"
        hint="Sets where the route starts."
        options={[
          {
            label: "Waterline",
            options: [
              { value: "lowtide", label: "Lowtide", code: "LT-04" },
              { value: "glasswater", label: "Glasswater", code: "GW-11" },
            ],
          },
          {
            label: "Inland",
            options: [
              { value: "cinder-row", label: "Cinder Row", code: "CR-02" },
              { value: "stacks", label: "The Stacks", code: "ST-27" },
              { value: "meridian", label: "Meridian Heights", code: "MH-01", disabled: true },
            ],
          },
        ]}
      />
      <Select
        label="Uplink"
        placeholder="No carrier"
        disabled
        options={[{ value: "vanta", label: "Vanta relay" }]}
      />
    </>
  )
}

Install this example

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/select-demo.json

Resources

View as Markdown