Styling

Styling

Style the input by passing it your custom class names like so:

<VerificationInput
  classNames={{
    container: "container",
    character: "character",
    characterInactive: "character--inactive",
    characterSelected: "character--selected",
    characterFilled: "character--filled",
  }}
/>

The following illustration shows the component structure.

elements

Contributing

Example


·
·
·
·
·
.character {
  border: none;
  font-size: 20px;
  border-radius: 8px;
 
  /* light theme */
  color: #272729;
  background-color: #f6f5fa;
  box-shadow: 0 2px 0 #e4e2f5;
 
  /* dark theme */
  color: #fff;
  background-color: #222;
  box-shadow: 0 2px 0 #444;
}

With Cursor (Caret)


·
·
·
·
·
·
.character--selected {
  position: relative;
}
 
/* optionally hide placeholder (in case it overlaps the cursor) */
.character--selected:not(.character--filled) {
  color: transparent;
}
 
.character--selected:not(.character--filled)::after {
  content: "";
  width: 1px;
  height: 25px;
  background-color: #333;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: blink 1s infinite step-end;
}
 
@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}