Input group
Text, units, dropdowns and buttons joined to an input, so the whole row is one field — one border, one focus ring. For icons inside a field, see Form adorn.
<div class="input-group">
<span class="input-group-text">$</span>
<input class="form-control" type="number" aria-label="Price">
<span class="input-group-text">USD</span>
</div>
<div class="input-group">
<span class="input-group-text"><i class="mi mi-at-sign"></i></span>
<input class="form-control" placeholder="username" aria-label="Username">
</div>
Plain text
Add .input-group-plain and the text has no fill, so it reads as part of the value.
<div class="input-group input-group-plain">
<span class="input-group-text">https://</span>
<input class="form-control" value="moey.shop" aria-label="Website">
</div>
<div class="input-group input-group-plain">
<input class="form-control" type="number" value="1.2" step="0.1" aria-label="Weight">
<span class="input-group-text">kg</span>
</div>
With a dropdown
A .form-select inside a group is a normal Moey dropdown that takes only the room it needs.
<div class="input-group">
<input class="form-control" type="number" aria-label="Amount">
<select class="form-select" aria-label="Currency">
<option>USD</option><option selected>EUR</option><option>GBP</option>
</select>
</div>
Buttons
Buttons attach to the edge — any color, strength or icon button.
<div class="input-group">
<input class="form-control" placeholder="Discount code" aria-label="Discount code">
<button class="btn btn-default" type="button">Apply</button>
</div>
<div class="input-group">
<input class="form-control" value="https://moey.shop/r/7Hq2" readonly aria-label="Share link">
<button class="btn" type="button" aria-label="Copy link">
<i class="mi mi-copy"></i>
</button>
</div>
Inset buttons
.input-group-inset floats the buttons inside the field with a little space around them — nice for newsletter and search boxes.
<div class="input-group input-group-inset">
<input class="form-control" type="email" placeholder="you@example.com" aria-label="Email">
<button class="btn btn-default btn-sm" type="button">Subscribe</button>
</div>
Several inputs
Put as many inputs as you need side by side; a thin line separates them.
<div class="input-group">
<span class="input-group-text">Name</span>
<input class="form-control" placeholder="First" aria-label="First name">
<input class="form-control" placeholder="Last" aria-label="Last name">
</div>
<div class="input-group">
<span class="input-group-text">$</span>
<input class="form-control" type="number" placeholder="Min" aria-label="Minimum price">
<span class="input-group-text">to</span>
<input class="form-control" type="number" placeholder="Max" aria-label="Maximum price">
</div>
Checkboxes, textareas and adorned inputs
<div class="input-group">
<label class="input-group-text">
<input class="form-check-input" type="checkbox" aria-label="Send a gift note">
</label>
<input class="form-control" aria-label="Gift note">
</div>
<div class="input-group">
<div class="form-adorn">
<i class="mi mi-lock adorn-start"></i>
<input class="form-control" type="password" aria-label="Password">
</div>
<button class="btn" type="button"><i class="mi mi-refresh-cw"></i>Generate</button>
</div>
Sizes and filled
.input-group-sm and .input-group-lg size everything inside — use .btn-sm / .btn-lg buttons to match. .form-filled (on the group or a parent) gives the borderless look.
<div class="input-group input-group-sm">…</div>
<div class="input-group input-group-lg">…</div>
<div class="input-group form-filled">…</div>
In a field, with validation
Inside a .field the label, hint and error work as usual. The whole group turns red when its input is invalid — add a space or a capital letter to the address, then click away.
<div class="field">
<label class="form-label" for="store">Store address</label>
<div class="input-group">
<span class="input-group-text">https://</span>
<input class="form-control" id="store" pattern="[a-z0-9\-]+" required>
<span class="input-group-text">.moey.shop</span>
</div>
<div class="form-error">Use only lowercase letters, numbers and dashes.</div>
</div>
| Class | What it does |
|---|---|
.input-group | The row. One border and one focus ring around everything inside |
.input-group-text | Text, a unit, an icon, or a checkbox / radio |
.form-control · .form-select · .form-adorn · .btn | What can go inside — as many as you like, in any order |
.input-group-plain | Text without a fill |
.input-group-inset | Buttons float inside the field instead of touching the edge |
.input-group-sm · .input-group-lg | Smaller or larger (match with .btn-sm / .btn-lg) |
.form-filled | Borderless, filled look — on the group or any parent |