Datetime Picker Ref
spectrumui/datetime-picker-refFreeComponent
component for the Datetime Picker Ref
Install it
npx shadcn@latest add https://ui.spectrumhq.in/r/datetime-picker-ref.jsonSource
1"use client";2import React, { useRef, useState } from "react";3import { Button } from "@/components/ui/button";4import {5 DateTimePicker,6 DateTimePickerRef,7} from "@/components/ui/datetime-picker";89const DatetimePickerRef = () => {10 const [date, setDate] = useState<Date | undefined>(undefined);11 const ref = useRef<DateTimePickerRef>(null);1213 return (14 <div className="w-72 space-y-3">15 <Button16 onClick={() => {17 alert(JSON.stringify(ref.current?.value?.toLocaleString()));18 /** following are the ref operations which is equivalent to button. */19 // ref.current?.focus();20 // ref.current?.blur();21 // ...22 }}23 >24 alert ref value25 </Button>26 <DateTimePicker ref={ref} value={date} onChange={setDate} />27 </div>28 );29};3031export default DatetimePickerRef;
What it pulls in
Other registry items
Files it writes
More from spectrumui
All 182 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | spectrumui | Components | Free | no deps | |
| Alert demoalert-1 | spectrumui | Components | Free | 1 dep | |
| Alert 2alert-2 | spectrumui | Components | Free | no deps | |
| Alert 3alert-3 | spectrumui | Components | Free | 1 dep | |
| Alert 4alert-4 | spectrumui | Components | Free | 1 dep | |
| Animated Cardanimated-card | spectrumui | Components | Free | 1 dep · 2 files | |
| Animated Draweranimated-drawer | spectrumui | Components | Free | 4 deps | |
| Animated SVG Chartanimated-SVG-chart | spectrumui | Components | Free | 1 dep |
