# Compact time interval selector

> Compact time interval selector

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

- Page, with a live preview: https://shadcn.exchange/r/reui/c-button-group-46
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-button-group-46-light-d3971b5f91fab6dd.png
- Registry item: https://reui.io/r/new-york-v4/c-button-group-46.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-46.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`

## Files

### `c-button-group-46.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 { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"

const intervals = [
  {
    id: "1m",
    icon: (
      <IconPlaceholder
        lucide="ClockIcon"
        tabler="IconClock"
        hugeicons="ClockIcon"
        phosphor="ClockIcon"
        remixicon="RiTimeLine"
        aria-hidden="true"
      />
    ),
  },
  {
    id: "5m",
    icon: (
      <IconPlaceholder
        lucide="ClockIcon"
        tabler="IconClock"
        hugeicons="ClockIcon"
        phosphor="ClockIcon"
        remixicon="RiTimeLine"
        aria-hidden="true"
      />
    ),
  },
  {
    id: "1H",
    icon: (
      <IconPlaceholder
        lucide="ClockIcon"
        tabler="IconClock"
        hugeicons="ClockIcon"
        phosphor="ClockIcon"
        remixicon="RiTimeLine"
        aria-hidden="true"
      />
    ),
  },
  {
    id: "1D",
    icon: (
      <IconPlaceholder
        lucide="CalendarIcon"
        tabler="IconCalendar"
        hugeicons="Calendar02Icon"
        phosphor="CalendarIcon"
        remixicon="RiCalendarLine"
        aria-hidden="true"
      />
    ),
  },
  {
    id: "1W",
    icon: (
      <IconPlaceholder
        lucide="CalendarDaysIcon"
        tabler="IconCalendarWeek"
        hugeicons="Calendar03Icon"
        phosphor="CalendarBlankIcon"
        remixicon="RiCalendarCheckLine"
        aria-hidden="true"
      />
    ),
  },
  {
    id: "Auto",
    icon: (
      <IconPlaceholder
        lucide="SparklesIcon"
        tabler="IconSparkles"
        hugeicons="MagicWand01Icon"
        phosphor="MagicWandIcon"
        remixicon="RiMagicLine"
        aria-hidden="true"
      />
    ),
  },
]

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

  return (
    <ButtonGroup>
      {intervals.map((interval) => (
        <Button
          key={interval.id}
          variant="outline"
          size="sm"
          className={cn(
            "h-7 gap-1.5 px-2.5 text-xs tabular-nums",
            active === interval.id ? "bg-muted" : ""
          )}
          onClick={() => setActive(interval.id)}
        >
          {interval.icon}
          {interval.id}
        </Button>
      ))}
    </ButtonGroup>
  )
}
```
