# Select preview

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

[View Select preview on CyberSpec](https://www.cyberspec.dev/preview/select)

## 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.

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

## Example

```tsx
"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

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

## Resources

- [Select documentation](https://www.cyberspec.dev/components/sidebar/select.md)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Select source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/select.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/select.json)
