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

Prop for a separator? #128

Open
niikkiin opened this issue Apr 12, 2021 · 1 comment
Open

Prop for a separator? #128

niikkiin opened this issue Apr 12, 2021 · 1 comment

Comments

@niikkiin
Copy link

Hi, Is there any way to add a separator for each input or after a certain input?
For example:
image

@acusti
Copy link

acusti commented Oct 17, 2021

i accomplished this via CSS (which felt appropriate, because it’s a matter of presentation). it’s a little trickier than it should be, because input elements don’t support ::before / ::after pseudo elements, but i used flex-box plus order with pseudo elements on the .react-code-input wrapper:

.react-code-input {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.react-code-input::before,
.react-code-input::after {
    content: "";
    margin: 0px 16px;
    width: 20x;
    height: 3px;
    background-color: #999;
}

.react-code-input input:nth-child(1) {
    order: 1;
}
.react-code-input input:nth-child(2) {
    order: 2;
}
.react-code-input input:nth-child(3) {
    order: 3;
}
.react-code-input::before {
    order: 4;
}
.react-code-input input:nth-child(4) {
    order: 5;
}
.react-code-input input:nth-child(5) {
    order: 6;
}
.react-code-input::after {
    order: 7;
}
.react-code-input input:nth-child(6) {
    order: 8;
}
.react-code-input input:nth-child(7) {
    order: 9;
}
.react-code-input input:nth-child(8) {
    order: 10;
}

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

2 participants