date-picker-with-presets.json — ui Source File
Architecture documentation for date-picker-with-presets.json, a json file in the ui codebase.
Entity Profile
Source Code
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "date-picker-with-presets",
"type": "registry:example",
"dependencies": [
"date-fns"
],
"registryDependencies": [
"button",
"calendar",
"popover",
"select"
],
"files": [
{
"path": "registry/new-york-v4/examples/date-picker-with-presets.tsx",
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { addDays, format } from \"date-fns\"\nimport { CalendarIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/registry/new-york-v4/ui/button\"\nimport { Calendar } from \"@/registry/new-york-v4/ui/calendar\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/registry/new-york-v4/ui/popover\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/registry/new-york-v4/ui/select\"\n\nexport default function DatePickerWithPresets() {\n const [date, setDate] = React.useState<Date>()\n\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n variant={\"outline\"}\n className={cn(\n \"w-[240px] justify-start text-left font-normal\",\n !date && \"text-muted-foreground\"\n )}\n >\n <CalendarIcon />\n {date ? format(date, \"PPP\") : <span>Pick a date</span>}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"flex w-auto flex-col space-y-2 p-2\"\n >\n <Select\n onValueChange={(value) =>\n setDate(addDays(new Date(), parseInt(value)))\n }\n >\n <SelectTrigger>\n <SelectValue placeholder=\"Select\" />\n </SelectTrigger>\n <SelectContent position=\"popper\">\n <SelectItem value=\"0\">Today</SelectItem>\n <SelectItem value=\"1\">Tomorrow</SelectItem>\n <SelectItem value=\"3\">In 3 days</SelectItem>\n <SelectItem value=\"7\">In a week</SelectItem>\n </SelectContent>\n </Select>\n <div className=\"rounded-md border\">\n <Calendar mode=\"single\" selected={date} onSelect={setDate} />\n </div>\n </PopoverContent>\n </Popover>\n )\n}\n",
"type": "registry:example"
}
]
}
Source
Frequently Asked Questions
What does date-picker-with-presets.json do?
date-picker-with-presets.json is a source file in the ui codebase, written in json.
Where is date-picker-with-presets.json in the architecture?
date-picker-with-presets.json is located at deprecated/www/public/r/styles/new-york-v4/date-picker-with-presets.json (directory: deprecated/www/public/r/styles/new-york-v4).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free