TextField
A text field allows a user to enter a plain text value with a keyboard.
Usage#
Demo#
import { TextField } from "pigment-ui"; function TextFieldDemo() { return <TextField label="First name" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Size#
import { TextField } from "pigment-ui"; function TextFieldSize() { return ( <div className="flex flex-col gap-4"> <TextField size="sm" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> <TextField size="md" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> <TextField size="lg" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> </div> ); }
Radius#
import { TextField } from "pigment-ui"; function TextFieldRadius() { return ( <div className="flex flex-col gap-4"> <TextField radius="sm" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> <TextField radius="md" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> <TextField radius="lg" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> <TextField radius="full" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> <TextField radius="none" label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> </div> ); }
Content#
import { Button } from "pigment-ui"; import { PinIcon, UserIcon } from "lucide-react"; function TextFieldContent() { return <TextField startContent={<UserIcon />} endContent={<PinIcon />} label="First name" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Invalid#
import { TextField } from "pigment-ui"; function TextFieldInvalid() { return <TextField isInvalid errorMessage="This is an error message." label="First name" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Disabled#
import { TextField } from "pigment-ui"; function TextFieldDisabled() { return <TextField isDisabled label="First name" description="Lorem ipsum dolor sit amet." className="w-64" />; }
Validation#
import { Button, TextField } from "pigment-ui"; function TextFieldValidation() { return ( <form className="space-y-4"> <TextField isRequired label="First name" description="Lorem ipsum dolor sit amet." className="w-64" /> <Button type="submit">Submit</Button> </form> ); }