Slab
Slab

Navigation

Pagination

Buttons for moving between pages, with an ellipsis for the ones it doesn't show.

Element
<slab-pagination>
Built on
<nav> + <button>s

Example

Here's a styled version, <slab-styled-pagination>. It's not in the package — it's an example of what you can build with the headless element. Copy it and make it yours at the bottom of this page. Switch to "As it ships" to see the same markup with the headless element and no CSS at all. That's your starting point.

Styled example As it ships
HTML
<slab-styled-pagination label="Pour log" page="5" total="12"></slab-styled-pagination>
HTML
<slab-pagination label="Pour log" page="5" total="12"></slab-pagination>

Usage

Install
pnpm add slab-elements lit
ReactLitVueSvelteEmberHTML
import 'slab-elements/pagination.js';

export function MyPagination() {
  return (
    <slab-pagination page={1} total={20}></slab-pagination>
  );
}

MyPagination.jsx React 19 or later, which sets props on custom elements as properties.

import 'slab-elements/pagination.js';
import { html, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';

@customElement('my-pagination')
export class MyPagination extends LitElement {
  render() {
    return html`
      <slab-pagination page="1" total="20"></slab-pagination>
    `;
  }
}

my-pagination.ts Slab is built on Lit, so its elements are at home in Lit's templates.

<script setup>
import 'slab-elements/pagination.js';
</script>

<template>
  <slab-pagination :page="1" :total="20"></slab-pagination>
</template>

MyPagination.vue Let Vue's compiler know slab- tags are custom elements with isCustomElement.

<script>
  import 'slab-elements/pagination.js';
</script>

<slab-pagination page={1} total={20}></slab-pagination>

MyPagination.svelte Svelte binds properties and events to custom elements like any other element.

import 'slab-elements/pagination.js';

export const MyPagination = <template>
  <slab-pagination page="1" total="20"></slab-pagination>
</template>;

MyPagination.gjs Ember sets attributes, and a dynamic value like {{this.max}} sets the property when the element has one. {{on}} listens for any event by its name.

<script type="module">
  import 'slab-elements/pagination.js';
</script>

<slab-pagination page="1" total="20"></slab-pagination>

index.html Any bundler (or an import map) takes care of the imports.

When it dispatches “change”, read the new page and navigate.

Behavior

Pagination with no visual styles: a <nav> around a list of <button>s, one for each page shown, between a previous and a next one.

The first and last pages are always shown, and so are siblings pages either side of the current one. The pages between those are an ellipsis, so there are always as many items, and the buttons don't move as the page changes.

The current page's button has aria-current="page". Previous and Next are aria-disabled rather than disabled at either end, so focus stays on them when they reach it. Clicking a page sets page and dispatches "change".

Style it through its parts and :state(first) and :state(last), which are set on the first and last pages. The current page's button is also ::part(current).

API

<slab-pagination>

Attributes
Name Type Default Description
total Required number How many pages there are.
label string Names the navigation. "Pagination" in English when unset.
next-label string The next button's text and so its accessible name. "Next" in English when unset.
page number 1 The current page, from 1 to total.
previous-label string The previous button's text and so its accessible name. "Previous" in English when unset.
siblings number 1 How many pages are shown either side of the current one.
Properties
Name Type Description
pageLabel (page: number) => string Names each page's button, which shows only the number, from that number. "Page" and the number in English when unset.
Events
Name Type Description
change Event When the user goes to another page. Setting page doesn't dispatch it.
CSS parts
Name Description
current The current page's button
ellipsis In place of the pages that aren't shown
item Each button's or ellipsis's list item
list The buttons
nav The navigation
next The button to the next page
page Each page's button
previous The button to the previous page
CSS states
Name Description
:state(first) While it's on the first page.
:state(last) While it's on the last page.

Copy and own it

<slab-styled-pagination> isn't in the package. It's an example — copy it into your project and change whatever you want. Keyboard, focus, ARIA, forms, and events all come from the headless element, and the styles only reach in through ::part() and :state(), same as yours would.

ReactLitVueSvelteEmber

The same styles, written from outside the element, so there's nothing to subclass. The CSS styles every <slab-pagination> on the page. Import tokens.css, the colors and fonts every styled example shares, once, wherever your global styles go.

Each component registers its headless element and imports its CSS. Use it like the element: its props are the element's attributes and properties.

Pagination.jsx
import 'slab-elements/pagination.js';
import './pagination.css';

export function Pagination(props) {
  return <slab-pagination {...props} />;
}
pagination.css
slab-pagination::part(list) {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

slab-pagination::part(page),
slab-pagination::part(previous),
slab-pagination::part(next) {
  background-color: var(--paper);
  block-size: 2.5rem;
  border: var(--border);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  min-inline-size: 2.5rem;
  padding: 0 0.75rem;
  transition:
    background-color 100ms,
    box-shadow 100ms;
}

slab-pagination::part(page):hover,
slab-pagination::part(previous):hover,
slab-pagination::part(next):hover {
  background-color: var(--chalk);
}

slab-pagination::part(page):active,
slab-pagination::part(previous):active,
slab-pagination::part(next):active {
  box-shadow: 1px 1px 0 var(--ink);
}

slab-pagination::part(page):focus-visible,
slab-pagination::part(previous):focus-visible,
slab-pagination::part(next):focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 3px;
}

slab-pagination::part(current) {
  background-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ember);
  color: var(--paper);
}

slab-pagination::part(current):hover {
  background-color: var(--ink);
}

slab-pagination::part(ellipsis) {
  color: var(--ash);
  font-family: var(--font-mono);
  padding-inline: 0.25rem;
}

slab-pagination:state(first)::part(previous),
slab-pagination:state(last)::part(next) {
  background-color: var(--chalk);
  border-style: dashed;
  box-shadow: none;
  color: var(--ash);
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  slab-pagination::part(page),
  slab-pagination::part(previous),
  slab-pagination::part(next) {
    transition: none;
  }
}
tokens.css
:root {
  /* Secondary text. 6.8:1 and 6.9:1 on paper. */
  --ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
  --border: 2px solid var(--ink);

  /* Behind disabled and read-only controls, and hovered rows. */
  --chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));

  /*
    The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
    enough for borders, fills and large text, but not always for small text,
    which takes "--ember-deep".
  */
  --ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));

  /*
    Orange for small text on paper, and for paper text on it. 5.7:1 and
    7.4:1.
  */
  --ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
  --font-body: var(
    --slab-styled-font-body,
    'IBM Plex Sans',
    system-ui,
    sans-serif
  );
  --font-display: var(
    --slab-styled-font-display,
    'Zilla Slab',
    rockwell,
    'Roboto Slab',
    serif
  );
  --font-mono: var(
    --slab-styled-font-mono,
    'IBM Plex Mono',
    ui-monospace,
    monospace
  );
  --ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
  --paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));

  /* The hard, offset shadow a raised surface casts. */
  --shadow: 4px 4px 0 var(--ink);
}

/*
  Forced colors, such as Windows' contrast themes, replace every color that
  isn't a system color, so ember fills and paper marks all become the same
  background, and a checked Checkbox looks like an unchecked one. The palette
  becomes the user's system colors instead, which are kept. Ember is the
  highlight, the color of what's selected, and ember-deep, being for text and
  for paper text on it, is the text color.
*/
@media (forced-colors: active) {
  :host {
    --ash: GrayText;
    --chalk: Canvas;
    --ember: Highlight;
    --ember-deep: CanvasText;
    --ink: CanvasText;
    --paper: Canvas;
  }
}

Under the hood, it's just the headless element, subclassed, with styles set. That's it. To use it, copy these files, swap the tag in @customElement() for one of your own, and import it. tokens.styles.ts holds the colors and fonts every styled example shares, so you only need it once.

pagination.ts
import { customElement } from 'lit/decorators.js';
import Pagination from 'slab-elements/pagination.js';
import styles from './pagination.styles.js';
import tokens from './tokens.styles.js';

declare global {
  interface HTMLElementTagNameMap {
    'slab-styled-pagination': StyledPagination;
  }
}

/**
 * Pagination, styled: a course of square buttons, with the current page in
 * ink.
 */
@customElement('slab-styled-pagination')
export default class StyledPagination extends Pagination {
  static override styles = [tokens, styles];
}
pagination.styles.ts
import { css } from 'lit';

/*
  At the first and last pages, Previous and Next are "aria-disabled" rather
  than disabled, so they keep focus. They're styled from Pagination's
  ":state(first)" and ":state(last)".
*/
export default css`
  [part~='list'] {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  [part~='page'],
  [part~='previous'],
  [part~='next'] {
    background-color: var(--paper);
    block-size: 2.5rem;
    border: var(--border);
    box-shadow: 3px 3px 0 var(--ink);
    color: var(--ink);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    min-inline-size: 2.5rem;
    padding: 0 0.75rem;
    transition:
      background-color 100ms,
      box-shadow 100ms;

    &:hover {
      background-color: var(--chalk);
    }

    &:active {
      box-shadow: 1px 1px 0 var(--ink);
    }

    &:focus-visible {
      outline: 3px solid var(--ember);
      outline-offset: 3px;
    }
  }

  [part~='current'] {
    background-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ember);
    color: var(--paper);

    &:hover {
      background-color: var(--ink);
    }
  }

  [part~='ellipsis'] {
    color: var(--ash);
    font-family: var(--font-mono);
    padding-inline: 0.25rem;
  }

  :host(:state(first)) [part~='previous'],
  :host(:state(last)) [part~='next'] {
    background-color: var(--chalk);
    border-style: dashed;
    box-shadow: none;
    color: var(--ash);
    cursor: not-allowed;
  }

  @media (prefers-reduced-motion: reduce) {
    [part~='page'],
    [part~='previous'],
    [part~='next'] {
      transition: none;
    }
  }
`;
tokens.styles.ts
import { css } from 'lit';

/*
  The styled components' palette and type, taken from the logo: ink for the
  courses, ember for the base, paper behind them.

  Each is a short alias for a "--slab-styled-*" property, with the default as
  its fallback. Retheming is "--slab-styled-ember" and the rest on ":root",
  which every shadow root inherits. Were the defaults declared under those
  names here instead, each host's own declaration would shadow the page's.

  Each default is "light-dark()", so the components follow the page's
  "color-scheme": "dark" for dark, "light" for light, and "light dark" to
  follow the operating system. Ink and paper trade places in the dark, so
  ink is always the text and paper always what's behind it. Contrast is given
  as light, then dark.
*/
export default css`
  :host {
    /* Secondary text. 6.8:1 and 6.9:1 on paper. */
    --ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
    --border: 2px solid var(--ink);

    /* Behind disabled and read-only controls, and hovered rows. */
    --chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));

    /*
      The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
      enough for borders, fills and large text, but not always for small text,
      which takes "--ember-deep".
    */
    --ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));

    /*
      Orange for small text on paper, and for paper text on it. 5.7:1 and
      7.4:1.
    */
    --ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
    --font-body: var(
      --slab-styled-font-body,
      'IBM Plex Sans',
      system-ui,
      sans-serif
    );
    --font-display: var(
      --slab-styled-font-display,
      'Zilla Slab',
      rockwell,
      'Roboto Slab',
      serif
    );
    --font-mono: var(
      --slab-styled-font-mono,
      'IBM Plex Mono',
      ui-monospace,
      monospace
    );
    --ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
    --paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));

    /* The hard, offset shadow a raised surface casts. */
    --shadow: 4px 4px 0 var(--ink);
  }

  /*
    Forced colors, such as Windows' contrast themes, replace every color that
    isn't a system color, so ember fills and paper marks all become the same
    background, and a checked Checkbox looks like an unchecked one. The palette
    becomes the user's system colors instead, which are kept. Ember is the
    highlight, the color of what's selected, and ember-deep, being for text and
    for paper text on it, is the text color.
  */
  @media (forced-colors: active) {
    :host {
      --ash: GrayText;
      --chalk: Canvas;
      --ember: Highlight;
      --ember-deep: CanvasText;
      --ink: CanvasText;
      --paper: Canvas;
    }
  }
`;

The same styles, written from outside the element, so there's nothing to subclass. The CSS styles every <slab-pagination> on the page. Import tokens.css, the colors and fonts every styled example shares, once, wherever your global styles go.

Each component registers its headless element and imports its CSS. Use it like the element: its props are the element's attributes and properties.

Pagination.vue
<script setup>
import 'slab-elements/pagination.js';
import './pagination.css';
</script>

<template>
  <slab-pagination><slot /></slab-pagination>
</template>
pagination.css
slab-pagination::part(list) {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

slab-pagination::part(page),
slab-pagination::part(previous),
slab-pagination::part(next) {
  background-color: var(--paper);
  block-size: 2.5rem;
  border: var(--border);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  min-inline-size: 2.5rem;
  padding: 0 0.75rem;
  transition:
    background-color 100ms,
    box-shadow 100ms;
}

slab-pagination::part(page):hover,
slab-pagination::part(previous):hover,
slab-pagination::part(next):hover {
  background-color: var(--chalk);
}

slab-pagination::part(page):active,
slab-pagination::part(previous):active,
slab-pagination::part(next):active {
  box-shadow: 1px 1px 0 var(--ink);
}

slab-pagination::part(page):focus-visible,
slab-pagination::part(previous):focus-visible,
slab-pagination::part(next):focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 3px;
}

slab-pagination::part(current) {
  background-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ember);
  color: var(--paper);
}

slab-pagination::part(current):hover {
  background-color: var(--ink);
}

slab-pagination::part(ellipsis) {
  color: var(--ash);
  font-family: var(--font-mono);
  padding-inline: 0.25rem;
}

slab-pagination:state(first)::part(previous),
slab-pagination:state(last)::part(next) {
  background-color: var(--chalk);
  border-style: dashed;
  box-shadow: none;
  color: var(--ash);
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  slab-pagination::part(page),
  slab-pagination::part(previous),
  slab-pagination::part(next) {
    transition: none;
  }
}
tokens.css
:root {
  /* Secondary text. 6.8:1 and 6.9:1 on paper. */
  --ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
  --border: 2px solid var(--ink);

  /* Behind disabled and read-only controls, and hovered rows. */
  --chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));

  /*
    The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
    enough for borders, fills and large text, but not always for small text,
    which takes "--ember-deep".
  */
  --ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));

  /*
    Orange for small text on paper, and for paper text on it. 5.7:1 and
    7.4:1.
  */
  --ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
  --font-body: var(
    --slab-styled-font-body,
    'IBM Plex Sans',
    system-ui,
    sans-serif
  );
  --font-display: var(
    --slab-styled-font-display,
    'Zilla Slab',
    rockwell,
    'Roboto Slab',
    serif
  );
  --font-mono: var(
    --slab-styled-font-mono,
    'IBM Plex Mono',
    ui-monospace,
    monospace
  );
  --ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
  --paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));

  /* The hard, offset shadow a raised surface casts. */
  --shadow: 4px 4px 0 var(--ink);
}

/*
  Forced colors, such as Windows' contrast themes, replace every color that
  isn't a system color, so ember fills and paper marks all become the same
  background, and a checked Checkbox looks like an unchecked one. The palette
  becomes the user's system colors instead, which are kept. Ember is the
  highlight, the color of what's selected, and ember-deep, being for text and
  for paper text on it, is the text color.
*/
@media (forced-colors: active) {
  :host {
    --ash: GrayText;
    --chalk: Canvas;
    --ember: Highlight;
    --ember-deep: CanvasText;
    --ink: CanvasText;
    --paper: Canvas;
  }
}

The same styles, written from outside the element, so there's nothing to subclass. The CSS styles every <slab-pagination> on the page. Import tokens.css, the colors and fonts every styled example shares, once, wherever your global styles go.

Import pagination.js once, such as in your root layout, and use <slab-pagination> as is. A Svelte component around it would take slot="…" content as its own slot and drop it.

pagination.js
import 'slab-elements/pagination.js';
import './pagination.css';
pagination.css
slab-pagination::part(list) {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

slab-pagination::part(page),
slab-pagination::part(previous),
slab-pagination::part(next) {
  background-color: var(--paper);
  block-size: 2.5rem;
  border: var(--border);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  min-inline-size: 2.5rem;
  padding: 0 0.75rem;
  transition:
    background-color 100ms,
    box-shadow 100ms;
}

slab-pagination::part(page):hover,
slab-pagination::part(previous):hover,
slab-pagination::part(next):hover {
  background-color: var(--chalk);
}

slab-pagination::part(page):active,
slab-pagination::part(previous):active,
slab-pagination::part(next):active {
  box-shadow: 1px 1px 0 var(--ink);
}

slab-pagination::part(page):focus-visible,
slab-pagination::part(previous):focus-visible,
slab-pagination::part(next):focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 3px;
}

slab-pagination::part(current) {
  background-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ember);
  color: var(--paper);
}

slab-pagination::part(current):hover {
  background-color: var(--ink);
}

slab-pagination::part(ellipsis) {
  color: var(--ash);
  font-family: var(--font-mono);
  padding-inline: 0.25rem;
}

slab-pagination:state(first)::part(previous),
slab-pagination:state(last)::part(next) {
  background-color: var(--chalk);
  border-style: dashed;
  box-shadow: none;
  color: var(--ash);
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  slab-pagination::part(page),
  slab-pagination::part(previous),
  slab-pagination::part(next) {
    transition: none;
  }
}
tokens.css
:root {
  /* Secondary text. 6.8:1 and 6.9:1 on paper. */
  --ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
  --border: 2px solid var(--ink);

  /* Behind disabled and read-only controls, and hovered rows. */
  --chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));

  /*
    The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
    enough for borders, fills and large text, but not always for small text,
    which takes "--ember-deep".
  */
  --ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));

  /*
    Orange for small text on paper, and for paper text on it. 5.7:1 and
    7.4:1.
  */
  --ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
  --font-body: var(
    --slab-styled-font-body,
    'IBM Plex Sans',
    system-ui,
    sans-serif
  );
  --font-display: var(
    --slab-styled-font-display,
    'Zilla Slab',
    rockwell,
    'Roboto Slab',
    serif
  );
  --font-mono: var(
    --slab-styled-font-mono,
    'IBM Plex Mono',
    ui-monospace,
    monospace
  );
  --ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
  --paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));

  /* The hard, offset shadow a raised surface casts. */
  --shadow: 4px 4px 0 var(--ink);
}

/*
  Forced colors, such as Windows' contrast themes, replace every color that
  isn't a system color, so ember fills and paper marks all become the same
  background, and a checked Checkbox looks like an unchecked one. The palette
  becomes the user's system colors instead, which are kept. Ember is the
  highlight, the color of what's selected, and ember-deep, being for text and
  for paper text on it, is the text color.
*/
@media (forced-colors: active) {
  :host {
    --ash: GrayText;
    --chalk: Canvas;
    --ember: Highlight;
    --ember-deep: CanvasText;
    --ink: CanvasText;
    --paper: Canvas;
  }
}

The same styles, written from outside the element, so there's nothing to subclass. The CSS styles every <slab-pagination> on the page. Import tokens.css, the colors and fonts every styled example shares, once, wherever your global styles go.

Each component registers its headless element and imports its CSS. Use it like the element: its attributes and its content go to the element.

Pagination.gjs
import 'slab-elements/pagination.js';
import './pagination.css';

export const Pagination = <template>
  <slab-pagination ...attributes>{{yield}}</slab-pagination>
</template>;
pagination.css
slab-pagination::part(list) {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

slab-pagination::part(page),
slab-pagination::part(previous),
slab-pagination::part(next) {
  background-color: var(--paper);
  block-size: 2.5rem;
  border: var(--border);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  min-inline-size: 2.5rem;
  padding: 0 0.75rem;
  transition:
    background-color 100ms,
    box-shadow 100ms;
}

slab-pagination::part(page):hover,
slab-pagination::part(previous):hover,
slab-pagination::part(next):hover {
  background-color: var(--chalk);
}

slab-pagination::part(page):active,
slab-pagination::part(previous):active,
slab-pagination::part(next):active {
  box-shadow: 1px 1px 0 var(--ink);
}

slab-pagination::part(page):focus-visible,
slab-pagination::part(previous):focus-visible,
slab-pagination::part(next):focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 3px;
}

slab-pagination::part(current) {
  background-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ember);
  color: var(--paper);
}

slab-pagination::part(current):hover {
  background-color: var(--ink);
}

slab-pagination::part(ellipsis) {
  color: var(--ash);
  font-family: var(--font-mono);
  padding-inline: 0.25rem;
}

slab-pagination:state(first)::part(previous),
slab-pagination:state(last)::part(next) {
  background-color: var(--chalk);
  border-style: dashed;
  box-shadow: none;
  color: var(--ash);
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  slab-pagination::part(page),
  slab-pagination::part(previous),
  slab-pagination::part(next) {
    transition: none;
  }
}
tokens.css
:root {
  /* Secondary text. 6.8:1 and 6.9:1 on paper. */
  --ash: var(--slab-styled-ash, light-dark(#5e5a55, #a8a19a));
  --border: 2px solid var(--ink);

  /* Behind disabled and read-only controls, and hovered rows. */
  --chalk: var(--slab-styled-chalk, light-dark(#f4f1ec, #2b2926));

  /*
    The logo's orange, brighter in the dark. 4.25:1 and 5.2:1 on paper is
    enough for borders, fills and large text, but not always for small text,
    which takes "--ember-deep".
  */
  --ember: var(--slab-styled-ember, light-dark(#d9492a, #ec5f3b));

  /*
    Orange for small text on paper, and for paper text on it. 5.7:1 and
    7.4:1.
  */
  --ember-deep: var(--slab-styled-ember-deep, light-dark(#b3381a, #ff8566));
  --font-body: var(
    --slab-styled-font-body,
    'IBM Plex Sans',
    system-ui,
    sans-serif
  );
  --font-display: var(
    --slab-styled-font-display,
    'Zilla Slab',
    rockwell,
    'Roboto Slab',
    serif
  );
  --font-mono: var(
    --slab-styled-font-mono,
    'IBM Plex Mono',
    ui-monospace,
    monospace
  );
  --ink: var(--slab-styled-ink, light-dark(#1c1c1c, #f4f1ec));
  --paper: var(--slab-styled-paper, light-dark(#fff, #1a1918));

  /* The hard, offset shadow a raised surface casts. */
  --shadow: 4px 4px 0 var(--ink);
}

/*
  Forced colors, such as Windows' contrast themes, replace every color that
  isn't a system color, so ember fills and paper marks all become the same
  background, and a checked Checkbox looks like an unchecked one. The palette
  becomes the user's system colors instead, which are kept. Ember is the
  highlight, the color of what's selected, and ember-deep, being for text and
  for paper text on it, is the text color.
*/
@media (forced-colors: active) {
  :host {
    --ash: GrayText;
    --chalk: Canvas;
    --ember: Highlight;
    --ember-deep: CanvasText;
    --ink: CanvasText;
    --paper: Canvas;
  }
}