Input
Input fields allow users to enter text into a form.
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
export default function Basic() {
return (
<div className="grid w-full items-center gap-2">
<Label htmlFor="name">Your Name</Label>
<Input type="text" id="name" placeholder="Enter your name" />
</div>
);
}
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
export default function Disabled() {
return (
<div className="grid w-full items-center gap-2">
<Label htmlFor="disabled">Your Name</Label>
<Input type="text" id="disabled" placeholder="Enter your name" disabled />
</div>
);
}
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
export default function InputError() {
return (
<div className="grid w-full items-center gap-2">
<Label htmlFor="error">Your Name</Label>
<Input
type="text"
id="error"
placeholder="Enter your name"
className="border-red-600"
/>
<p className="text-xs font-medium text-red-600">This field is required</p>
</div>
);
}
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
export default function GroupWithSpace() {
return (
<div className="flex w-full gap-2">
<Input type="text" id="name" placeholder="Enter your name" />
<Button variant="outline">Submit</Button>
</div>
);
}
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
export default function GroupWithBorder() {
return (
<div className="flex w-full -space-x-px">
<Input
type="text"
id="name"
placeholder="Enter your name"
className="rounded-r-none"
/>
<Button variant="outline" className="rounded-l-none">
Submit
</Button>
</div>
);
}