# V select 13

> Controlled with External Display

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-select-13).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-select-13
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-select-13-light-0117e2c7c08cdb14.png
- Registry item: https://ui.cnippet.dev/r/v-select-13.json
- Categories: select
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-select-13.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/select`

## Files

### `registry/default/variants/v-select-13.tsx`

```tsx
"use client";

import { useState } from "react";
import { Badge } from "@/registry/default/ui/badge";
import {
  Select,
  SelectItem,
  SelectPopup,
  SelectTrigger,
  SelectValue,
} from "@/registry/default/ui/select";

type PriorityItem = { label: string; value: string | null };

const priorities: PriorityItem[] = [
  { label: "Select priority", value: null },
  { label: "Critical", value: "critical" },
  { label: "High", value: "high" },
  { label: "Medium", value: "medium" },
  { label: "Low", value: "low" },
];

const badgeVariant: Record<string, "destructive" | "secondary" | "outline"> = {
  critical: "destructive",
  high: "destructive",
  low: "outline",
  medium: "secondary",
};

export default function Particle() {
  const [selected, setSelected] = useState<PriorityItem | null>(null);

  return (
    <div className="flex w-56 flex-col gap-3">
      <Select
        items={priorities}
        onValueChange={(v) => setSelected(v as PriorityItem)}
      >
        <SelectTrigger>
          <SelectValue />
        </SelectTrigger>
        <SelectPopup>
          {priorities.slice(1).map((item) => (
            <SelectItem key={item.value} value={item}>
              {item.label}
            </SelectItem>
          ))}
        </SelectPopup>
      </Select>
      <p className="text-muted-foreground text-sm">
        Priority:{" "}
        {selected?.value ? (
          <Badge
            className="ms-1"
            variant={badgeVariant[selected.value] ?? "outline"}
          >
            {selected.label}
          </Badge>
        ) : (
          <span>not set</span>
        )}
      </p>
    </div>
  );
}
```
