improved counter logic

This commit is contained in:
Oliver Bryan
2026-01-10 18:13:12 +00:00
parent dcc7b4d0a8
commit 6d67d6a7b3
2 changed files with 23 additions and 33 deletions

View File

@@ -14,6 +14,7 @@ export function Field({
tabIndex,
spellcheck,
maxLength,
showCounter = true,
}: {
label: string;
value?: string;
@@ -26,6 +27,7 @@ export function Field({
tabIndex?: number;
spellcheck?: boolean;
maxLength?: number;
showCounter?: boolean;
}) {
const [internalTouched, setInternalTouched] = useState(false);
const isTouched = submitAttempted || internalTouched;
@@ -59,6 +61,7 @@ export function Field({
tabIndex={tabIndex}
spellCheck={spellcheck}
maxLength={maxLength}
showCounter={showCounter}
/>
<div className="flex items-end justify-end w-full text-xs mb-0 -mt-1">
{error || invalidMessage !== "" ? (