Component
input-demo
not found in registry.
import { Input } from "@/components/ui/input"
export default function InputDemo() {
return <Input className="max-w-sm" type="email" placeholder="Email" />
}
Not found
Installation
Copy and paste the following code into your project.
"use client"
import * as React from "react"
import { ark } from "@ark-ui/react/factory"
import { cn } from "@/lib/utils"
export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
return (
<ark.input
type={type}
className={cn(
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:font-medium file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
{...props}
/>
)
}
)
Input.displayName = "Input"
export { Input }
Not Found
Update the import paths to match your project setup.
Usage
import { Input } from "@/components/ui/input"
<Input />
Examples
Default
Component
input-demo
not found in registry.
import { Input } from "@/components/ui/input"
export default function InputDemo() {
return <Input className="max-w-sm" type="email" placeholder="Email" />
}
Not found
File
Component
input-file
not found in registry.
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function InputFile() {
return (
<div className="grid w-full max-w-sm items-center gap-1.5">
<Label htmlFor="picture">Picture</Label>
<Input id="picture" type="file" />
</div>
)
}
Not found
Disabled
Component
input-disabled
not found in registry.
import { Input } from "@/components/ui/input"
export default function InputDisabled() {
return (
<Input className="max-w-sm" disabled type="email" placeholder="Email" />
)
}
Not found
With Label
Component
input-with-label
not found in registry.
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function InputWithLabel() {
return (
<div className="grid w-full max-w-sm items-center gap-1.5">
<Label htmlFor="email">Email</Label>
<Input type="email" id="email" placeholder="Email" />
</div>
)
}
Not found
With Button
Component
input-with-button
not found in registry.
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
export default function InputWithButton() {
return (
<div className="flex w-full max-w-sm items-center space-x-2">
<Input type="email" placeholder="Email" />
<Button type="submit">Subscribe</Button>
</div>
)
}
Not found