BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/optics/date-picker

Date Picker

optics/date-picker
FreeComponent

A date field component that allows users to enter and edit date.

See it running

Open the demo on optics

optics.agusmayol.com.ar/components/date-picker
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://optics.agusmayol.com.ar/r/date-picker.json

Source

registry/optics/date-picker.jsxoptics.agusmayol.com.ar/r/date-picker.json
1"use client";
2
3import * as React from "react";
4import { format } from "date-fns";
5import { CalendarIcon } from "lucide-react";
6
7import { cn } from "@/registry/optics/lib/utils";
8import { Button } from "@/registry/optics/button";
9import { Calendar } from "@/registry/optics/calendar";
10import {
11 Popover,
12 PopoverContent,
13 PopoverTrigger,
14} from "@/registry/optics/popover";
15
16function DatePicker({
17 date = null,
18 onDateChange = () => {},
19 placeholder = "Pick a date",
20 variant = "outline",
21 className = "",
22 ...props
23}) {
24 return (
25 <Popover>
26 <PopoverTrigger
27 render={
28 <Button
29 variant={variant || "outline"}
30 className={cn(
31 "w-[240px] justify-start text-left font-normal",
32 !date && "text-muted-foreground",
33 className,
34 )}
35 aria-label="Open date picker"
36 {...props}
37 >
38 <CalendarIcon />
39 {date ? format(date, "PPP") : <span>{placeholder}</span>}
40 </Button>
41 }
42 />
43 <PopoverContent className="w-auto p-0" align="start">
44 <Calendar
45 mode="single"
46 selected={date}
47 onSelect={onDateChange}
48 initialFocus
49 />
50 </PopoverContent>
51 </Popover>
52 );
53}
54
55DatePicker.displayName = "DatePicker";
56
57export { DatePicker };

What it pulls in

npm packages

  • react-day-picker
  • date-fns
  • lucide-react
  • clsx
  • tailwind-merge

Other registry items

  • https://optics.agusmayol.com.ar/r/button.json
  • https://optics.agusmayol.com.ar/r/calendar.json
  • https://optics.agusmayol.com.ar/r/popover.json
  • https://optics.agusmayol.com.ar/r/utils.json

Files it writes

  • registry/optics/date-picker.jsx

Facts

Registry
optics
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

Docs on optics optics.agusmayol.com.ar AgusMayol/optics on GitHub Raw registry item This item as JSON

More from optics

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionopticsComponentsFree5 deps
AlertalertopticsComponentsFree4 deps
Alert Dialogalert-dialogopticsComponentsFree4 deps
Aspect Ratioaspect-ratioopticsComponentsFree2 deps
Auto Heightauto-heightopticsComponentsFree3 deps
AvataravataropticsComponentsFree3 deps
BadgebadgeopticsComponentsFree4 deps
BreadcrumbbreadcrumbopticsComponentsFree4 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex