Skip to content

Conversation

@msamgan
Copy link
Contributor

@msamgan msamgan commented Oct 30, 2025

No description provided.

@tdubouchet
Copy link

tdubouchet commented Oct 31, 2025

@msamgan good idea ! I think the InputGroup component would be more appropriate.

@SantosVilanculos
Copy link
Contributor

@msamgan good idea ! I think the InputGroup component would be more appropriate.

Yes, but a reusable component would be better.

import { EyeClosedIcon, EyeIcon } from 'lucide-react';
import * as React from 'react';
import {
    InputGroup,
    InputGroupAddon,
    InputGroupButton,
    InputGroupInput
} from '@/components/ui/input-group';

function PasswordInput(
    props: Omit<React.ComponentProps<typeof InputGroupInput>, 'type'>
) {
    const [type, setType] = React.useState<'password' | 'text'>('password');

    return (
        <InputGroup>
            <InputGroupInput type={type} {...props} />
            <InputGroupAddon align="inline-end">
                <InputGroupButton
                    size="icon-xs"
                    onClick={() => {
                        setType(value => {
                            return value === 'password' ? 'text' : 'password';
                        });
                    }}
                >
                    {type === 'password' ? <EyeClosedIcon /> : <EyeIcon />}
                </InputGroupButton>
            </InputGroupAddon>
        </InputGroup>
    );
}

export { PasswordInput };

@WendellAdriel
Copy link
Member

Hey there @msamgan, thanks for the contribution! 💪
I agree with @SantosVilanculos here, let's create a reusable component for this.
I'm going to change the PR to draft, when you have it ready to review, just change it back and I'll take a look at it ASAP.

@WendellAdriel WendellAdriel marked this pull request as draft January 6, 2026 20:29
Copy link
Member

@WendellAdriel WendellAdriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my comment above on creating a reusable component for this

@devsravi
Copy link

devsravi commented Jan 7, 2026

good idea ! I thin

Yes, this is good Instead of modifying an existing component, I had also created a PasswordInput component in my project.

@msamgan
Copy link
Contributor Author

msamgan commented Jan 8, 2026

Please check my comment above on creating a reusable component for this

I will make the updates on this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants