# Segmented control with dropdown inside button group

> Segmented control with dropdown inside button group

A shadcn/ui block from the [@reui](https://reui.io) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/reui/c-button-group-34).

- Page, with a live preview: https://shadcn.exchange/r/reui/c-button-group-34
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-button-group-34-light-38e489d86c92222d.png
- Registry item: https://reui.io/r/new-york-v4/c-button-group-34.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://reui.io/r/new-york-v4/c-button-group-34.json
```

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

## Dependencies

- npm packages: `cn`
- Registry items: `button`, `button-group`, `dropdown-menu`

## Files

### `c-button-group-34.tsx`

```tsx
"use client"

import { useState } from "react"

import { cn } from "cn"
import { Button } from "@/components/ui/button"
import { ButtonGroup } from "@/components/ui/button-group"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"

const items = [
  {
    id: "Routes",
    label: "Routes",
    icon: (
      <IconPlaceholder
        lucide="RouteIcon"
        tabler="IconRoute"
        hugeicons="Route01Icon"
        phosphor="PathIcon"
        remixicon="RiRouteLine"
        aria-hidden="true"
        className="size-3.5 opacity-60"
      />
    ),
  },
  {
    id: "Paths",
    label: "Paths",
    icon: (
      <IconPlaceholder
        lucide="WaypointsIcon"
        tabler="IconEaseInOutControlPoints"
        hugeicons="EaseCurveControlPointsIcon"
        phosphor="LineSegmentsIcon"
        remixicon="RiRouteLine"
        aria-hidden="true"
        className="size-3.5 opacity-60"
      />
    ),
  },
  {
    id: "Bot Name",
    label: "Bot Name",
    icon: (
      <IconPlaceholder
        lucide="BotIcon"
        tabler="IconRobotFace"
        hugeicons="RoboticIcon"
        phosphor="RobotIcon"
        remixicon="RiRobot2Line"
        aria-hidden="true"
        className="size-3.5 opacity-60"
      />
    ),
  },
]

export function Pattern() {
  const [active, setActive] = useState("Paths")

  return (
    <ButtonGroup>
      {items.map((item) => (
        <Button
          key={item.id}
          variant="outline"
          className={cn(active === item.id ? "bg-muted" : "")}
          onClick={() => setActive(item.id)}
        >
          {item.icon}
          {item.label}
        </Button>
      ))}
      <DropdownMenu>
        <DropdownMenuTrigger render={<Button variant="outline" size="icon" />}>
          <IconPlaceholder
            lucide="ChevronDownIcon"
            tabler="IconChevronDown"
            hugeicons="ArrowDown01Icon"
            phosphor="CaretDownIcon"
            remixicon="RiArrowDownSLine"
            aria-hidden="true"
          />
        </DropdownMenuTrigger>
        <DropdownMenuContent align="end" className="min-w-40">
          <DropdownMenuItem>Filter by Group</DropdownMenuItem>
          <DropdownMenuItem>Sort by Name</DropdownMenuItem>
          <DropdownMenuItem>Export Data</DropdownMenuItem>
        </DropdownMenuContent>
      </DropdownMenu>
    </ButtonGroup>
  )
}
```
