Forms
Input group
Joins inputs with prefix and suffix addons or buttons; group sizes apply to every child.
Example
<div class="grid gap-3 max-w-sm">
<div class="input-group">
<span class="input-group-addon">https://</span>
<input class="input" placeholder="example.com" aria-label="Domain">
</div>
<div class="input-group">
<input type="number" class="input" value="120" aria-label="Amount">
<span class="input-group-addon">USD</span>
</div>
<div class="input-group input-group-sm">
<input type="email" class="input" placeholder="Email" aria-label="Email">
<button type="button" class="input-group-button">Subscribe</button>
</div>
</div>Classes
8 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Base | Base class of the input group. On a <div> in the example. Sets flex display, alignment, width, corner radius, margin and stacking order.CSS |
|
| Part | Part of the input group. On a <span> in the example. Sets flex display, alignment, gap, padding, text size and text style, and --_line and --_shadow.CSS |
|
| Part | Part of the input group. On a <button> in the example. Sets inline-flex display, alignment, gap, padding, text size and font weight.CSS |
|
| Size | Extra small size. Not used in the example above. Sets 4 custom properties.CSS |
|
| Size | Small size. On a <div> in the example. Sets 4 custom properties.CSS |
|
| Size | Medium, the default size. Not used in the example above. Sets 4 custom properties.CSS |
|
| Size | Large size. Not used in the example above. Sets 4 custom properties.CSS |
|
| Size | Extra large size. Not used in the example above. Sets 4 custom properties.CSS |
Usage
Components ship inside the same stylesheet as the utilities. There is nothing else to install and no script to load: link Monsoon and write the markup.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<!-- Input group: start from the base class, then add modifiers -->
<div class="grid gap-3 max-w-sm">
<div class="input-group">
<span class="input-group-addon">https://</span>
<input class="input" placeholder="example.com" aria-label="Domain">
</div>
<div class="input-group">
<input type="number" class="input" value="120" aria-label="Amount">
<span class="input-group-addon">USD</span>
</div>
<div class="input-group input-group-sm">
<input type="email" class="input" placeholder="Email" aria-label="Email">
<button type="button" class="input-group-button">Subscribe</button>
</div>
</div>Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Give every control a visible
labellinked withfor, or anaria-labelwhen the purpose is obvious from context. Link help and error text witharia-describedby; invalid styles use:user-invalid, so they appear only after the user interacts. - Use
buttonfor actions andafor navigation. Icon only buttons need anaria-label; decorative icons carryaria-hidden="true". - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.