my/ui

Command Palette

Search for a command to run...

All components

Time Picker

calendar

Ui-Layouts component.

responsive · 600px

Install

Same command in any shadcn project — React (Vite/CRA), Next.js, Remix, Astro, and more:

$npx shadcn@latest add https://your-domain/r/time-picker.json

Usage

import Cmp from "@/registry/ui-layouts/time-picker";

export default function Demo() {
  return <Cmp />;
}

Component source

'use client';

import { SmartDatetimeInput } from '@/registry/ui-layouts/datetime-input';
import React, { useState } from 'react';

export default function Component() {
  const [selectedDate, setSelectedDate] = useState<Date | undefined>(undefined);

  const handleDateChange = (date: Date) => {
    setSelectedDate(date);
    console.log('Selected date:', date);
  };

  return (
    <div className='p-4 max-w-md mx-auto py-10'>
      <SmartDatetimeInput
        value={selectedDate}
        showCalendar={false}
        showTimePicker={true}
        onValueChange={handleDateChange}
        placeholder='Enter a date and time'
        className='lg:w-96'
      />
      {/* {selectedDate && (
        <p className='mt-4'>Selected Date: {selectedDate.toLocaleString()}</p>
      )} */}
    </div>
  );
}

Dependencies

chrono-node@latestreact-day-picker@^8.9.1

Source: Ui-Layouts