BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/boldkit/date-picker

Date Picker

boldkit/date-picker
FreeComponent

A single-date picker: a button trigger that opens a calendar popover

Live preview

live · rendered by the registry
Rendered by boldkit on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://boldkit.dev/r/date-picker.json

Source

registry/default/ui/date-picker.tsxboldkit.dev/r/date-picker.json
1import * as React from 'react'
2import { format } from 'date-fns'
3import { CalendarIcon } from 'lucide-react'
4import { cn } from '@/lib/utils'
5import { Button } from '@/components/ui/button'
6import { Calendar } from '@/components/ui/calendar'
7import {
8 Popover,
9 PopoverContent,
10 PopoverTrigger,
11} from '@/components/ui/popover'
12
13export interface DatePickerProps {
14 value?: Date
15 onChange?: (date: Date | undefined) => void
16 placeholder?: string
17 /** date-fns format string for the trigger label. */
18 dateFormat?: string
19 disabled?: boolean
20 className?: string
21}
22
23/** A single-date picker: a button trigger that opens a calendar in a popover. */
24export function DatePicker({
25 value,
26 onChange,
27 placeholder = 'Pick a date',
28 dateFormat = 'LLL dd, y',
29 disabled,
30 className,
31}: DatePickerProps) {
32 const [open, setOpen] = React.useState(false)
33 const isControlled = value !== undefined
34 const [uncontrolled, setUncontrolled] = React.useState<Date | undefined>(value)
35
36 const selected = isControlled ? value : uncontrolled
37
38 const handleSelect = (date: Date | undefined) => {
39 if (!isControlled) setUncontrolled(date)
40 onChange?.(date)
41 setOpen(false)
42 }
43
44 return (
45 <Popover open={open} onOpenChange={setOpen}>
46 <PopoverTrigger asChild>
47 <Button
48 variant="outline"
49 disabled={disabled}
50 className={cn(
51 'w-[260px] justify-start gap-2 font-bold normal-case',
52 !selected && 'text-muted-foreground',
53 className
54 )}
55 >
56 <CalendarIcon className="h-4 w-4" />
57 {selected ? format(selected, dateFormat) : placeholder}
58 </Button>
59 </PopoverTrigger>
60 <PopoverContent className="w-auto p-0" align="start">
61 <Calendar
62 mode="single"
63 selected={selected}
64 onSelect={handleSelect}
65 initialFocus
66 />
67 </PopoverContent>
68 </Popover>
69 )
70}

What it pulls in

npm packages

  • date-fns
  • lucide-react

Other registry items

  • @boldkit/utils
  • @boldkit/button
  • @boldkit/calendar
  • @boldkit/popover

Files it writes

  • registry/default/ui/date-picker.tsx

Facts

Registry
boldkit
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
today

Go to the source

Docs on boldkit boldkit.dev ANIBIT14/boldkit on GitHub Raw registry item This item as JSON

More from boldkit

All 94 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionboldkitComponentsFree2 deps
AlertalertboldkitComponentsFree2 deps
Alert Dialogalert-dialogboldkitComponentsFree1 dep
ASCII Shapesascii-shapesboldkitComponentsFreeno deps
Aspect Ratioaspect-ratioboldkitComponentsFree1 dep
AvataravatarboldkitComponentsFree1 dep
BadgebadgeboldkitComponentsFree1 dep
BreadcrumbbreadcrumbboldkitComponentsFree2 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