From 5b515940cc54f87c695f8e476b3f4a70d41368b6 Mon Sep 17 00:00:00 2001 From: akshaywritescode Date: Thu, 20 Nov 2025 19:38:28 +0530 Subject: [PATCH 1/2] feat(ui/input): Adds built-in password visibility toggle for --- apps/v4/registry/new-york-v4/ui/input.tsx | 43 +++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/apps/v4/registry/new-york-v4/ui/input.tsx b/apps/v4/registry/new-york-v4/ui/input.tsx index 89169058d05..952d5bc2f01 100644 --- a/apps/v4/registry/new-york-v4/ui/input.tsx +++ b/apps/v4/registry/new-york-v4/ui/input.tsx @@ -1,21 +1,58 @@ +"use client" + import * as React from "react" +import { Eye, EyeOff } from "lucide-react" import { cn } from "@/lib/utils" -function Input({ className, type, ...props }: React.ComponentProps<"input">) { - return ( +type InputProps = React.ComponentProps<"input"> & { + showPasswordToggle?: boolean +} + +function Input({ + className, + type, + showPasswordToggle = true, + ...props +}: InputProps) { + const [show, setShow] = React.useState(false) + + const isPassword = type === "password" && showPasswordToggle + + // Build the main input + const inputElement = ( ) + + // If not password-type → return plain input + if (!isPassword) return inputElement + + // Otherwise render wrapper with toggle + return ( +
+ {inputElement} + + +
+ ) } export { Input } From 4d538653e7a73936937b2508aeb315d003d9a281 Mon Sep 17 00:00:00 2001 From: akshaywritescode Date: Thu, 20 Nov 2025 20:42:32 +0530 Subject: [PATCH 2/2] made password toggle buttom accesible --- apps/v4/registry/new-york-v4/ui/input.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/v4/registry/new-york-v4/ui/input.tsx b/apps/v4/registry/new-york-v4/ui/input.tsx index 952d5bc2f01..5e4d0335edd 100644 --- a/apps/v4/registry/new-york-v4/ui/input.tsx +++ b/apps/v4/registry/new-york-v4/ui/input.tsx @@ -47,7 +47,8 @@ function Input({ type="button" onClick={() => setShow(!show)} className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground cursor-pointer" - tabIndex={-1} + aria-label={show ? "Hide password" : "Show password"} + aria-pressed={show} > {show ? : }