Date Picker
edgecom/date-pickerFreeComponent
The Edgecom Date Picker component.
Live preview
live · rendered by the registry
Rendered by edgecom on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://design.edgecom.ai/r/date-picker.jsonSource
1"use client"23import * as React from "react"4import { CalendarIcon } from "lucide-react"56import { cn } from "@/lib/utils"7import { Button } from "@/components/ui/button"8import { Calendar } from "@/components/ui/calendar"9import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover"1011function DatePicker({12 value,13 defaultValue,14 onValueChange,15 placeholder = "Pick a date",16 disabled,17 className,18}: {19 value?: Date20 defaultValue?: Date21 onValueChange?: (date: Date | undefined) => void22 placeholder?: string23 disabled?: boolean24 className?: string25}) {26 const [open, setOpen] = React.useState(false)27 const [internal, setInternal] = React.useState<Date | undefined>(defaultValue)28 const selected = value ?? internal2930 function handleSelect(date: Date | undefined) {31 if (value === undefined) setInternal(date)32 onValueChange?.(date)33 if (date) setOpen(false)34 }3536 return (37 <Popover open={open} onOpenChange={setOpen}>38 <PopoverTrigger39 render={40 <Button41 variant="outline"42 disabled={disabled}43 data-empty={!selected}44 className={cn(45 "w-56 justify-start font-normal data-[empty=true]:text-muted-foreground",46 className47 )}48 >49 <CalendarIcon data-icon="inline-start" />50 {selected51 ? selected.toLocaleDateString(undefined, {52 year: "numeric",53 month: "long",54 day: "numeric",55 })56 : placeholder}57 </Button>58 }59 />60 <PopoverContent className="w-auto p-0" align="start">61 <Calendar mode="single" selected={selected} onSelect={handleSelect} autoFocus />62 </PopoverContent>63 </Popover>64 )65}6667export { DatePicker }
What it pulls in
npm packages
Other registry items
Files it writes
More from edgecom
All 66 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | edgecom | Components | Free | 2 deps | |
| Alertalert | edgecom | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | edgecom | Components | Free | 1 dep | |
| Avataravatar | edgecom | Components | Free | 1 dep | |
| Badgebadge | edgecom | Components | Free | 2 deps | |
| Bannerbanner | edgecom | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | edgecom | Components | Free | 2 deps | |
| Buttonbutton | edgecom | Components | Free | 2 deps |
