TimeField
A time field allows users to enter and edit time values using a keyboard. Each part of a time value is displayed in an individually editable segment.
Usage#
Demo#
import { TimeField } from "pigment-ui"; function TimeFieldDemo() { return <TimeField label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Size#
import { TimeField } from "pigment-ui"; function TimeFieldSize() { return ( <div className="flex flex-col gap-4"> <TimeField size="sm" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> <TimeField size="md" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> <TimeField size="lg" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> </div> ); }
Radius#
import { TimeField } from "pigment-ui"; function TimeFieldRadius() { return ( <div className="flex flex-col gap-4"> <TimeField radius="sm" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> <TimeField radius="md" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> <TimeField radius="lg" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> <TimeField radius="full" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> <TimeField radius="none" label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" /> </div> ); }
Content#
import { Button } from "pigment-ui"; import { PinIcon, UserIcon } from "lucide-react"; function TimeFieldContent() { return <TimeField startContent={<UserIcon />} endContent={<PinIcon />} label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Invalid#
import { TimeField } from "pigment-ui"; function TimeFieldInvalid() { return <TimeField isInvalid errorMessage="This is an error message." label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Disabled#
import { TimeField } from "pigment-ui"; function TimeFieldDisabled() { return <TimeField isDisabled label="Event time" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Validation#
import { Button, TimeField } from "pigment-ui"; function TimeFieldValidation() { return ( <form className="space-y-4"> <TimeField isRequired label="Event time" description="Lorem ipsum dolor sit amet." classname="w-64" /> <Button type="submit">Submit</Button> </form> ); }