From 114c8d3c2249cbcc6104445b7569702263a7bdd3 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 7 Feb 2025 17:59:28 +0530 Subject: [PATCH] (feat:Input) required prop --- frontend/src/components/Input.tsx | 9 ++++++++- frontend/src/components/types/index.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Input.tsx b/frontend/src/components/Input.tsx index f7b1765e..f224e2ba 100644 --- a/frontend/src/components/Input.tsx +++ b/frontend/src/components/Input.tsx @@ -8,6 +8,7 @@ const Input = ({ isAutoFocused = false, placeholder, label, + required = false, maxLength, className, colorVariant = 'silver', @@ -40,13 +41,19 @@ const Input = ({ onChange={onChange} onPaste={onPaste} onKeyDown={onKeyDown} + required={required} > {children} {label && (
- + {label} + {required && ( + + * + + )}
)} diff --git a/frontend/src/components/types/index.ts b/frontend/src/components/types/index.ts index a7ff5405..1d4b3a61 100644 --- a/frontend/src/components/types/index.ts +++ b/frontend/src/components/types/index.ts @@ -9,6 +9,7 @@ export type InputProps = { name?: string; placeholder?: string; label?: string; + required?: boolean; className?: string; children?: React.ReactElement; onChange: (