# V date picker 12

> Recurring Event Date Picker

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

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

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-date-picker-12.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/date-picker`

## Files

### `registry/default/variants/v-date-picker-12.tsx`

```tsx
"use client";

import { format } from "date-fns";
import { CalendarIcon, RepeatIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@/registry/default/ui/button";
import { Calendar } from "@/registry/default/ui/calendar";
import {
  Popover,
  PopoverPopup,
  PopoverTrigger,
} from "@/registry/default/ui/popover";

type Recurrence = "none" | "daily" | "weekly" | "monthly";

const OPTIONS: { id: Recurrence; label: string }[] = [
  { id: "none", label: "Does not repeat" },
  { id: "daily", label: "Daily" },
  { id: "weekly", label: "Weekly" },
  { id: "monthly", label: "Monthly" },
];

export default function Particle() {
  const [date, setDate] = useState<Date | undefined>();
  const [recurrence, setRecurrence] = useState<Recurrence>("none");
  const [open, setOpen] = useState(false);

  const summaryParts = [
    date ? format(date, "EEE, MMM d, yyyy") : null,
    recurrence !== "none"
      ? OPTIONS.find((o) => o.id === recurrence)?.label
      : null,
  ].filter(Boolean);

  return (
    <div className="w-full max-w-xs space-y-3">
      <Popover onOpenChange={setOpen} open={open}>
        <PopoverTrigger
          render={<Button className="w-full justify-start" variant="outline" />}
        >
          <CalendarIcon />
          {date ? format(date, "MMM d, yyyy") : "Pick a date"}
        </PopoverTrigger>
        <PopoverPopup>
          <Calendar
            disabled={{ before: new Date() }}
            mode="single"
            onSelect={(d) => {
              setDate(d);
              setOpen(false);
            }}
            selected={date}
          />
        </PopoverPopup>
      </Popover>

      <div className="flex items-center gap-2">
        <RepeatIcon className="size-4 shrink-0 text-muted-foreground" />
        <div className="flex flex-wrap gap-1.5">
          {OPTIONS.map((opt) => (
            <button
              className={`rounded-full border px-3 py-0.5 font-medium text-xs transition-colors ${
                recurrence === opt.id
                  ? "border-primary bg-primary text-primary-foreground"
                  : "text-muted-foreground hover:border-foreground/30"
              }`}
              key={opt.id}
              onClick={() => setRecurrence(opt.id)}
              type="button"
            >
              {opt.label}
            </button>
          ))}
        </div>
      </div>

      {summaryParts.length > 0 && (
        <p className="text-muted-foreground text-xs">
          Scheduled:{" "}
          <span className="font-medium text-foreground">
            {summaryParts.join(" · ")}
          </span>
        </p>
      )}
    </div>
  );
}
```
