Files
shadcn/apps/v4/public/r/styles/default/date-picker-with-presets.json
zeekay 16c4453cc1 feat: sync with upstream shadcn/ui (through [email protected])
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in:
- [email protected] through [email protected] releases
- New apps/v4 directory structure
- Registry system improvements and MCP server
- Framework support (Vue, Svelte, React Native)
- New templates (vite-app, monorepo-next, laravel)
- Zod 4 compatibility (scoped override for zod@>4)
- Test fixture corrections for alias resolution

All 867 merge conflicts resolved preserving Hanzo customizations.
1020/1020 shadcn tests pass.
2026-02-09 10:44:26 -08:00

23 lines
2.3 KiB
JSON

{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "date-picker-with-presets",
"type": "registry:example",
"author": "shadcn (https://ui.shadcn.com)",
"dependencies": [
"date-fns"
],
"registryDependencies": [
"button",
"calendar",
"popover",
"select"
],
"files": [
{
"path": "examples/date-picker-with-presets.tsx",
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { addDays, format } from \"date-fns\"\nimport { Calendar as CalendarIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/registry/default/ui/button\"\nimport { Calendar } from \"@/registry/default/ui/calendar\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/registry/default/ui/popover\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/registry/default/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-[280px] 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 className=\"flex w-auto flex-col space-y-2 p-2\">\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",
"target": ""
}
]
}