Navigation and overlays
Pagination
Page links with previous and next, an ellipsis, the current page, disabled items, three sizes and pill or joined styles.
Example
<nav aria-label="Pagination"><ul class="pagination"><li><a href="#" class="pagination-item pagination-prev pagination-disabled" aria-disabled="true">Previous</a></li><li><a href="#" class="pagination-item" aria-current="page">1</a></li><li><a href="#" class="pagination-item">2</a></li><li><a href="#" class="pagination-item">3</a></li><li><span class="pagination-ellipsis" aria-hidden="true"></span></li><li><a href="#" class="pagination-item">12</a></li><li><a href="#" class="pagination-item pagination-next">Next</a></li></ul></nav>Classes
14 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 pagination. On an <ul> in the example. Sets flex display, alignment, gap and text size, and 5 custom properties.CSS |
|
| Modifier | Modifier, combined with the pagination class. On an <a> in the example. Sets inline-flex display, alignment, gap, width, height and padding.CSS |
|
| Modifier | Modifier, combined with the pagination class. Not used in the example above. Sets text color and background.CSS |
|
| Modifier | Modifier, combined with the pagination class. On an <a> in the example. Sets opacity.CSS |
|
| Part | Part of the pagination. On a <span> in the example. Sets inline-flex display, alignment, gap, width, height and padding.CSS |
|
| Modifier | Modifier, combined with the pagination class. On an <a> in the example. Sets generated content, width, height, background and padding.CSS |
|
| Modifier | Modifier, combined with the pagination class. On an <a> in the example. Sets generated content, width, height, background and padding.CSS |
|
| Size | Extra small size. Not used in the example above. Sets --pg-size, --pg-fs and --pg-radius.CSS |
|
| Size | Small size. Not used in the example above. Sets --pg-size, --pg-fs and --pg-radius.CSS |
|
| Size | Medium, the default size. Not used in the example above. Sets --pg-size, --pg-fs and --pg-radius.CSS |
|
| Size | Large size. Not used in the example above. Sets --pg-size, --pg-fs and --pg-radius.CSS |
|
| Size | Extra large size. Not used in the example above. Sets --pg-size, --pg-fs and --pg-radius.CSS |
|
| Modifier | Modifier, combined with the pagination class. Not used in the example above. Sets --pg-radius.CSS |
|
| Modifier | Modifier, combined with the pagination class. Not used in the example above. Sets gap, margin, border, corner radius and background.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">
<!-- Pagination: start from the base class, then add modifiers -->
<nav aria-label="Pagination"><ul class="pagination"><li><a href="#" class="pagination-item pagination-prev pagination-disabled" aria-disabled="true">Previous</a></li><li><a href="#" class="pagination-item" aria-current="page">1</a></li><li><a href="#" class="pagination-item">2</a></li><li><a href="#" class="pagination-item">3</a></li><li><span class="pagination-ellipsis" aria-hidden="true"></span></li><li><a href="#" class="pagination-item">12</a></li><li><a href="#" class="pagination-item pagination-next">Next</a></li></ul></nav>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
- Wrap navigation in
navwith anaria-labelwhen there is more than one on the page, and mark the current link witharia-current="page". - 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.