Docs
Input
Input
Displays a form input field or a component that looks like an input field.
Input is a primitive meant to be used within other components. The examples below utilizes them inside TextField
Installation
Copy and paste the following code into your project.
import * as React from "react"
import { Input } from "react-aria-components"
import { cn } from "@/lib/utils"
export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
const _Input = ({ className, ...props }: InputProps) => {
return (
<Input
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:text-sm file:font-medium 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
)}
{...props}
/>
)
}
export { _Input as Input }
Update the import paths to match your project setup.
Usage
Basic
File
A file input can be created with an <Input type=“file”>
element, but this supports limited styling options and may not integrate well with the overall design of a website or application.
To overcome this, FileTrigger extends the functionality of the standard file input element by working with a pressable child such as a Button to create accessible file inputs that can be style as needed.
Disabled
With Label
With Description
Enter an email for us to contact you about your order.