Data display and layout
List
Rows with leading media, text and a trailing action, optionally divided, bordered and hoverable.
Example
<ul class="list list-divided list-bordered list-hover max-w-md"><li class="list-item"><span class="list-media avatar avatar-placeholder avatar-online">AK</span><div class="list-content"><p class="list-title">Ana Kohler</p><p class="list-description">Design lead</p></div><span class="list-action">Owner</span></li><li class="list-item"><span class="list-media avatar avatar-placeholder">MS</span><div class="list-content"><p class="list-title">Marco Silva</p><p class="list-description">Frontend engineer</p></div><a class="list-action" href="#">Edit</a></li><li class="list-item"><span class="list-media avatar avatar-placeholder avatar-offline">JD</span><div class="list-content"><p class="list-title">Julia Duarte</p><p class="list-description">Product manager</p></div><a class="list-action" href="#">Edit</a></li></ul>Classes
10 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 list. On an <ul> in the example. Sets flex display and alignment.CSS |
|
| Part | Part of the list. On a <li> in the example. A hook for state rules such as :where(.list) > .list-item.CSS |
|
| Modifier | Modifier, combined with the list class. On an <ul> in the example. Sets border.CSS |
|
| Modifier | Modifier, combined with the list class. On an <ul> in the example. Sets overflow, border, corner radius and background.CSS |
|
| Modifier | Modifier, combined with the list class. On an <ul> in the example. Sets transition and background.CSS |
|
| Part | Part of the list. On a <span> in the example. Sets flex display and alignment.CSS |
|
| Part | Part of the list. On a <div> in the example. Sets alignment and width.CSS |
|
| Part | Part of the list. On a <p> in the example. Sets overflow, font weight and text style.CSS |
|
| Part | Part of the list. On a <p> in the example. Sets text size and text color.CSS |
|
| Part | Part of the list. On a <span> in the example. Sets flex display, alignment, gap, margin, text color and text size.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">
<!-- List: start from the base class, then add modifiers -->
<ul class="list list-divided list-bordered list-hover max-w-md"><li class="list-item"><span class="list-media avatar avatar-placeholder avatar-online">AK</span><div class="list-content"><p class="list-title">Ana Kohler</p><p class="list-description">Design lead</p></div><span class="list-action">Owner</span></li><li class="list-item"><span class="list-media avatar avatar-placeholder">MS</span><div class="list-content"><p class="list-title">Marco Silva</p><p class="list-description">Frontend engineer</p></div><a class="list-action" href="#">Edit</a></li><li class="list-item"><span class="list-media avatar avatar-placeholder avatar-offline">JD</span><div class="list-content"><p class="list-title">Julia Duarte</p><p class="list-description">Product manager</p></div><a class="list-action" href="#">Edit</a></li></ul>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 meaningful images an
alttext and decorative onesalt="". Initials avatars should expose the full name to screen readers. - 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.