(feat:Input) required prop

This commit is contained in:
ManishMadan2882
2025-02-07 17:59:28 +05:30
parent 1aa0af3e58
commit 114c8d3c22
2 changed files with 9 additions and 1 deletions

View File

@@ -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}
</input>
{label && (
<div className="absolute -top-2 left-2">
<span className="bg-white px-2 text-xs text-gray-4000 dark:bg-outer-space dark:text-silver">
<span className="bg-white px-2 text-xs text-gray-4000 dark:bg-outer-space dark:text-silver flex items-center">
{label}
{required && (
<span className="text-[#D30000] dark:text-[#D42626] ml-0.5">
*
</span>
)}
</span>
</div>
)}

View File

@@ -9,6 +9,7 @@ export type InputProps = {
name?: string;
placeholder?: string;
label?: string;
required?: boolean;
className?: string;
children?: React.ReactElement;
onChange: (