Skip to main content
Glama
InputPassword.tsx1.24 kB
'use client'; import { EyeIcon, EyeOffIcon } from 'lucide-react'; import { type FC, type MouseEventHandler, useState } from 'react'; import { Input, type InputProps } from './Input'; type InputPasswordProps = Omit<InputProps, 'type'>; export const InputPassword: FC<InputPasswordProps> = (props) => { const [isPasswordRevealed, setIsPasswordRevealed] = useState(false); const handlePasswordReveal: MouseEventHandler<HTMLButtonElement> = (e) => { e.preventDefault(); e.stopPropagation(); setIsPasswordRevealed((isPasswordRevealed) => !isPasswordRevealed); }; const EyeIconComponent = isPasswordRevealed ? EyeIcon : EyeOffIcon; return ( <div className="relative"> <Input {...props} aria-label="password" type={isPasswordRevealed ? 'text' : 'password'} /> <button data-testid="eye-icon" type="button" className="absolute right-2 h-full flex-row items-center" onClick={handlePasswordReveal} aria-label={isPasswordRevealed ? 'Hide password' : 'Show password'} > <EyeIconComponent className="mr-2 inline-block cursor-pointer text-neutral" size={20} /> </button> </div> ); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server