Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholder? #72

Open
stephengardner opened this issue Nov 27, 2018 · 2 comments
Open

Placeholder? #72

stephengardner opened this issue Nov 27, 2018 · 2 comments

Comments

@stephengardner
Copy link

Is there any way to add a placeholder (ex: "-") for the input fields?

@40818419
Copy link
Owner

not yet possible, but could be useful feature

@alex-andreiev
Copy link

alex-andreiev commented Dec 28, 2020

import ReactCodeInput from "react-code-input";

export default function ExampleComponent({}: {}) {
    ...
    const inputRef = useRef<any>(null)

    useEffect(() => {
        if (null !== inputRef.current){
            document.querySelectorAll("input")
                    .forEach((node: HTMLInputElement) => node.setAttribute('placeholder', '0'));
        }
    })

    return (
       ...
        <ReactCodeInput
            ref={inputRef}
            fields={4}
            name="pin"
            type="text"
            inputMode="latin"
        />
       ...
    )} 

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

No branches or pull requests

3 participants