From 90eb9429fde5f06f08fed31531fefe6f1ebf75a5 Mon Sep 17 00:00:00 2001 From: Yash Date: Tue, 2 Apr 2024 11:36:40 +0000 Subject: [PATCH] input with icon --- apps/web/src/components/ui/input.tsx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx index 8a7a9340..dba310dc 100644 --- a/apps/web/src/components/ui/input.tsx +++ b/apps/web/src/components/ui/input.tsx @@ -20,6 +20,30 @@ const Input = React.forwardRef( ); }, ); -Input.displayName = "Input"; -export { Input }; +export interface InputWithIconProps + extends React.InputHTMLAttributes { + icon: React.ReactNode; +} + +const InputWithIcon = React.forwardRef( + ({ className, type, icon, ...props }, ref) => { + return ( +
+ {icon} + +
+ ); + }, +); +InputWithIcon.displayName = "Input"; + +export { Input, InputWithIcon };