Slab
Slab

Navigation

Toolbar

A group of controls that Tab reaches once, with the arrow keys to move between them.

Element
<slab-toolbar>
Built on
[role=toolbar]

Example

Here's a styled version, <slab-styled-toolbar>. 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-toolbar label="Finish">
  <button aria-pressed="true" type="button">Broom</button>
  <button aria-pressed="false" type="button">Trowel</button>
  <button aria-pressed="false" type="button">Stamp</button>
  <button aria-pressed="false" type="button" disabled>Polish</button>
</slab-styled-toolbar>
HTML
<slab-toolbar label="Finish">
  <button aria-pressed="true" type="button">Broom</button>
  <button aria-pressed="false" type="button">Trowel</button>
  <button aria-pressed="false" type="button">Stamp</button>
  <button aria-pressed="false" type="button" disabled>Polish</button>
</slab-toolbar>

Usage

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

export function MyToolbar() {
  return (
    <slab-toolbar label="Formatting">
      <button aria-pressed="false">Bold</button>
      <button aria-pressed="false">Italic</button>
      <button>Link</button>
    </slab-toolbar>
  );
}

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

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

@customElement('my-toolbar')
export class MyToolbar extends LitElement {
  render() {
    return html`
      <slab-toolbar label="Formatting">
        <button aria-pressed="false">Bold</button>
        <button aria-pressed="false">Italic</button>
        <button>Link</button>
      </slab-toolbar>
    `;
  }
}

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

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

<template>
  <slab-toolbar label="Formatting">
    <button aria-pressed="false">Bold</button>
    <button aria-pressed="false">Italic</button>
    <button>Link</button>
  </slab-toolbar>
</template>

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

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

<slab-toolbar label="Formatting">
  <button aria-pressed="false">Bold</button>
  <button aria-pressed="false">Italic</button>
  <button>Link</button>
</slab-toolbar>

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

import 'slab-elements/toolbar.js';

export const MyToolbar = <template>
  <slab-toolbar label="Formatting">
    <button aria-pressed="false">Bold</button>
    <button aria-pressed="false">Italic</button>
    <button>Link</button>
  </slab-toolbar>
</template>;

MyToolbar.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/toolbar.js';
</script>

<slab-toolbar label="Formatting">
  <button aria-pressed="false">Bold</button>
  <button aria-pressed="false">Italic</button>
  <button>Link</button>
</slab-toolbar>

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

Keyboard

Key What it does
Left, Right Moves to the previous or next control, wrapping and skipping disabled ones. Up and Down instead when orientation is “vertical”.
Home, End Moves to the first or last control.
Tab Leaves the toolbar. Coming back, focus returns to the control focused last.

Behavior

A toolbar with no visual styles: a [role=toolbar] around the controls slotted into it, usually <button>s, so Tab reaches the group once and the arrow keys move between them.

Exactly one control is tabbable: the one most recently focused, or the first that isn't disabled. Left and Right, or Up and Down when orientation is "vertical", move focus between them, wrapping at each end and skipping disabled ones, and Home and End go to the first and last. A control that edits text, such as a text <input>, keeps its arrow keys, and so does one that handles a key itself and cancels it. In a right-to-left page, Left and Right swap.

Controls are focused directly, so put ones that take focus themselves in it, such as <button>s, <input>s and links. A custom element whose focusable part is in its shadow root can't be made untabbable from outside it.

Style it through its part, and the controls directly.

API

<slab-toolbar>

Attributes
Name Type Default Description
label Required string Names the toolbar.
orientation 'horizontal' | 'vertical' 'horizontal' Which arrow keys move between the controls. Where they sit is still up to your styles.
Properties
Name Type Description
items Read-only HTMLElement[] What it moves focus between, in order.
Methods
Signature Description
focus(options?: FocusOptions): void Focuses it, or the part of it that takes focus.
Slots
Name Type Description
(default) Element
CSS parts
Name Description
toolbar The controls

Copy and own it

<slab-styled-toolbar> 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-toolbar> 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.

Toolbar.jsx
import 'slab-elements/toolbar.js';
import './toolbar.css';

export function Toolbar(props) {
  return <slab-toolbar {...props} />;
}
toolbar.css
slab-toolbar::part(toolbar) {
  background-color: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  display: flex;
  gap: 0.25rem;
  inline-size: fit-content;
  padding: 0.375rem;
}

slab-toolbar[orientation='vertical']::part(toolbar) {
  flex-direction: column;
}

slab-toolbar > button {
  background-color: transparent;
  border: 2px solid transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.375rem 0.75rem;
  text-transform: uppercase;
  transition:
    background-color 100ms,
    color 100ms;
}

slab-toolbar > button:hover {
  background-color: var(--chalk);
}

slab-toolbar > button:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 2px;
}

/*
  As specific as the hover above, and after it, so a pressed control keeps
  its ink while it's hovered. Were the hover to win, its chalk would sit
  under the pressed control's paper text.
*/
slab-toolbar > button[aria-pressed='true'] {
  background-color: var(--ink);
  color: var(--paper);
}

slab-toolbar > button:disabled {
  background-color: transparent;
  color: var(--ash);
  cursor: not-allowed;
  text-decoration: line-through;
}

@media (prefers-reduced-motion: reduce) {
  slab-toolbar > button {
    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.

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

declare global {
  interface HTMLElementTagNameMap {
    'slab-styled-toolbar': StyledToolbar;
  }
}

/**
 * Toolbar, styled: a raised bar of controls, with a pressed one in ink.
 */
@customElement('slab-styled-toolbar')
export default class StyledToolbar extends Toolbar {
  static override styles = [tokens, styles];
}
toolbar.styles.ts
import { css } from 'lit';

/*
  The controls are the consumer's own buttons, slotted in, so they're styled
  through "::slotted()". A toggle's "aria-pressed" is what shows it's on.
*/
export default css`
  [part~='toolbar'] {
    background-color: var(--paper);
    border: var(--border);
    box-shadow: var(--shadow);
    display: flex;
    gap: 0.25rem;
    inline-size: fit-content;
    padding: 0.375rem;
  }

  :host([orientation='vertical']) [part~='toolbar'] {
    flex-direction: column;
  }

  ::slotted(button) {
    background-color: transparent;
    border: 2px solid transparent;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.375rem 0.75rem;
    text-transform: uppercase;
    transition:
      background-color 100ms,
      color 100ms;
  }

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

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

  /*
    As specific as the hover above, and after it, so a pressed control keeps
    its ink while it's hovered. Were the hover to win, its chalk would sit
    under the pressed control's paper text.
  */
  ::slotted(button[aria-pressed='true']) {
    background-color: var(--ink);
    color: var(--paper);
  }

  ::slotted(button:disabled) {
    background-color: transparent;
    color: var(--ash);
    cursor: not-allowed;
    text-decoration: line-through;
  }

  @media (prefers-reduced-motion: reduce) {
    ::slotted(button) {
      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-toolbar> 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.

Toolbar.vue
<script setup>
import 'slab-elements/toolbar.js';
import './toolbar.css';
</script>

<template>
  <slab-toolbar><slot /></slab-toolbar>
</template>
toolbar.css
slab-toolbar::part(toolbar) {
  background-color: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  display: flex;
  gap: 0.25rem;
  inline-size: fit-content;
  padding: 0.375rem;
}

slab-toolbar[orientation='vertical']::part(toolbar) {
  flex-direction: column;
}

slab-toolbar > button {
  background-color: transparent;
  border: 2px solid transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.375rem 0.75rem;
  text-transform: uppercase;
  transition:
    background-color 100ms,
    color 100ms;
}

slab-toolbar > button:hover {
  background-color: var(--chalk);
}

slab-toolbar > button:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 2px;
}

/*
  As specific as the hover above, and after it, so a pressed control keeps
  its ink while it's hovered. Were the hover to win, its chalk would sit
  under the pressed control's paper text.
*/
slab-toolbar > button[aria-pressed='true'] {
  background-color: var(--ink);
  color: var(--paper);
}

slab-toolbar > button:disabled {
  background-color: transparent;
  color: var(--ash);
  cursor: not-allowed;
  text-decoration: line-through;
}

@media (prefers-reduced-motion: reduce) {
  slab-toolbar > button {
    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-toolbar> on the page. Import tokens.css, the colors and fonts every styled example shares, once, wherever your global styles go.

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

toolbar.js
import 'slab-elements/toolbar.js';
import './toolbar.css';
toolbar.css
slab-toolbar::part(toolbar) {
  background-color: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  display: flex;
  gap: 0.25rem;
  inline-size: fit-content;
  padding: 0.375rem;
}

slab-toolbar[orientation='vertical']::part(toolbar) {
  flex-direction: column;
}

slab-toolbar > button {
  background-color: transparent;
  border: 2px solid transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.375rem 0.75rem;
  text-transform: uppercase;
  transition:
    background-color 100ms,
    color 100ms;
}

slab-toolbar > button:hover {
  background-color: var(--chalk);
}

slab-toolbar > button:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 2px;
}

/*
  As specific as the hover above, and after it, so a pressed control keeps
  its ink while it's hovered. Were the hover to win, its chalk would sit
  under the pressed control's paper text.
*/
slab-toolbar > button[aria-pressed='true'] {
  background-color: var(--ink);
  color: var(--paper);
}

slab-toolbar > button:disabled {
  background-color: transparent;
  color: var(--ash);
  cursor: not-allowed;
  text-decoration: line-through;
}

@media (prefers-reduced-motion: reduce) {
  slab-toolbar > button {
    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-toolbar> 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.

Toolbar.gjs
import 'slab-elements/toolbar.js';
import './toolbar.css';

export const Toolbar = <template>
  <slab-toolbar ...attributes>{{yield}}</slab-toolbar>
</template>;
toolbar.css
slab-toolbar::part(toolbar) {
  background-color: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  display: flex;
  gap: 0.25rem;
  inline-size: fit-content;
  padding: 0.375rem;
}

slab-toolbar[orientation='vertical']::part(toolbar) {
  flex-direction: column;
}

slab-toolbar > button {
  background-color: transparent;
  border: 2px solid transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.375rem 0.75rem;
  text-transform: uppercase;
  transition:
    background-color 100ms,
    color 100ms;
}

slab-toolbar > button:hover {
  background-color: var(--chalk);
}

slab-toolbar > button:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 2px;
}

/*
  As specific as the hover above, and after it, so a pressed control keeps
  its ink while it's hovered. Were the hover to win, its chalk would sit
  under the pressed control's paper text.
*/
slab-toolbar > button[aria-pressed='true'] {
  background-color: var(--ink);
  color: var(--paper);
}

slab-toolbar > button:disabled {
  background-color: transparent;
  color: var(--ash);
  cursor: not-allowed;
  text-decoration: line-through;
}

@media (prefers-reduced-motion: reduce) {
  slab-toolbar > button {
    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;
  }
}