HomeComponentsInput Field

Input Field component

Input Generator

Options
8px
2px
16px
Colors
html
<div class="input-group">
  <input type="text" id="name" required placeholder=" " />
  <label for="name">Your Name</label>
</div>
css
.input-group {
  position: relative;
  font-family: sans-serif;
  width: 300px;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: all 0.2s;
  padding-top: 24px; padding-bottom: 8px;
}

.input-group input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #3b82f633;
}

.input-group label {
  color: #64748b;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.2s;
  pointer-events: none;
  font-size: 16px;
}


.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 8px;
  transform: none;
  font-size: 12px;
  color: #3b82f6;
  font-weight: 600;
}

GET MORE FROM THIS RESOURCE

Keep input labels visible

A placeholder disappears when someone types and should not be the only description of a field. Associate a visible label with the input and provide an example or hint separately. The input’s type and autocomplete value should match the information you ask for.

Use the generator to establish the appearance, then adapt the exported markup and styles to your application. A preview demonstrates the visual treatment; it does not certify your final interaction. Check the implementation with real content, a narrow screen, and keyboard input before publishing.

Try the component in the code editor →