Time Picker
Time Picker for a useful, keyboard-friendly product interface.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/time-picker.jsonUse it
Scroll horizontally for long lines
"use client";
import {TimePicker} from '@/components/jez-ui/ui/time-picker';
export default function Example(){
return <><div className="w-full max-w-sm"><div className="mb-7"><h3 className="text-2xl tracking-tight">Meet in the morning.</h3><p className="mt-2 text-sm leading-relaxed text-muted-foreground">Find a time that works for everyone.</p></div><TimePicker defaultValue="09:30"/></div></>;
}Props & types
Scroll horizontally for long lines
Omit<React.ComponentProps<typeof Input>, "type"> & { label?: string }Source
View 3 source files
registry/ui/time-picker.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
import { Input } from "./input";
export function TimePicker({
label = "Time",
className,
...props
}: Omit<React.ComponentProps<typeof Input>, "type"> & { label?: string }) {
return (
<label className={cn("grid gap-2 text-sm", className)}>
{label}
<Input type="time" {...props} />
</label>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
registry/ui/input.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Input({ className, ...props }: React.ComponentProps<"input">) {
return (
<input
className={cn(
"block h-10 w-full min-w-0 rounded-lg border border-border bg-background px-3 text-sm leading-normal shadow-[0_1px_2px_#00000004] transition-[border-color,box-shadow] placeholder:text-muted-foreground/75 hover:border-foreground/25 focus:border-primary focus:outline-none focus:ring-3 focus:ring-primary/10 aria-invalid:border-danger aria-invalid:ring-danger/10 disabled:cursor-not-allowed disabled:bg-muted/50 disabled:opacity-50",
className,
)}
{...props}
/>
);
}
Dependencies
clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.
Read the accessibility and performance guide →