Skip to content

Commit

Permalink
refactor(input): refactor universal input component to radix-ui (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Jun 19, 2023
1 parent c10ec1d commit 6fc9b65
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/components/ui/input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { cn } from "@libs/cn";
import { forwardRef } from "react";

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}

const Input = forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(
"flex h-10 w-full rounded-md border border-input bg-transparent 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
)}
ref={ref}
{...props}
/>
);
}
);
Input.displayName = "Input";

export { Input };

0 comments on commit 6fc9b65

Please sign in to comment.