# Grid List

> A list of rows that can hold their own buttons, links and checkboxes, moved through with the arrow keys and optionally selected.

`<slab-grid-list>` · Data · built on `[role=grid] + rows`

## Install

```sh
pnpm add slab-elements lit
```

## Usage

### React

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

```jsx
import 'slab-elements/grid-list.js';
import 'slab-elements/grid-list.item.js';

export function MyGridList() {
  return (
    <slab-grid-list label="Files" multiple>
      <slab-grid-list-item label="plan.pdf">
        plan.pdf
        <button type="button">Share</button>
        <a href="/files/plan.pdf">Download</a>
      </slab-grid-list-item>
      <slab-grid-list-item label="site.jpg">
        site.jpg
        <button type="button">Share</button>
        <a href="/files/site.jpg">Download</a>
      </slab-grid-list-item>
    </slab-grid-list>
  );
}
```

### Lit

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

```ts
import 'slab-elements/grid-list.js';
import 'slab-elements/grid-list.item.js';
import { html, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';

@customElement('my-grid-list')
export class MyGridList extends LitElement {
  render() {
    return html`
      <slab-grid-list label="Files" multiple>
        <slab-grid-list-item label="plan.pdf">
          plan.pdf
          <button type="button">Share</button>
          <a href="/files/plan.pdf">Download</a>
        </slab-grid-list-item>
        <slab-grid-list-item label="site.jpg">
          site.jpg
          <button type="button">Share</button>
          <a href="/files/site.jpg">Download</a>
        </slab-grid-list-item>
      </slab-grid-list>
    `;
  }
}
```

### Vue

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

```vue
<script setup>
import 'slab-elements/grid-list.js';
import 'slab-elements/grid-list.item.js';
</script>

<template>
  <slab-grid-list label="Files" multiple>
    <slab-grid-list-item label="plan.pdf">
      plan.pdf
      <button type="button">Share</button>
      <a href="/files/plan.pdf">Download</a>
    </slab-grid-list-item>
    <slab-grid-list-item label="site.jpg">
      site.jpg
      <button type="button">Share</button>
      <a href="/files/site.jpg">Download</a>
    </slab-grid-list-item>
  </slab-grid-list>
</template>
```

### Svelte

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

```svelte
<script>
  import 'slab-elements/grid-list.js';
  import 'slab-elements/grid-list.item.js';
</script>

<slab-grid-list label="Files" multiple>
  <slab-grid-list-item label="plan.pdf">
    plan.pdf
    <button type="button">Share</button>
    <a href="/files/plan.pdf">Download</a>
  </slab-grid-list-item>
  <slab-grid-list-item label="site.jpg">
    site.jpg
    <button type="button">Share</button>
    <a href="/files/site.jpg">Download</a>
  </slab-grid-list-item>
</slab-grid-list>
```

### Ember

`MyGridList.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.

```gjs
import 'slab-elements/grid-list.js';
import 'slab-elements/grid-list.item.js';

export const MyGridList = <template>
  <slab-grid-list label="Files" multiple>
    <slab-grid-list-item label="plan.pdf">
      plan.pdf
      <button type="button">Share</button>
      <a href="/files/plan.pdf">Download</a>
    </slab-grid-list-item>
    <slab-grid-list-item label="site.jpg">
      site.jpg
      <button type="button">Share</button>
      <a href="/files/site.jpg">Download</a>
    </slab-grid-list-item>
  </slab-grid-list>
</template>;
```

### HTML

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

```html
<script type="module">
  import 'slab-elements/grid-list.js';
  import 'slab-elements/grid-list.item.js';
</script>

<slab-grid-list label="Files" multiple>
  <slab-grid-list-item label="plan.pdf">
    plan.pdf
    <button type="button">Share</button>
    <a href="/files/plan.pdf">Download</a>
  </slab-grid-list-item>
  <slab-grid-list-item label="site.jpg">
    site.jpg
    <button type="button">Share</button>
    <a href="/files/site.jpg">Download</a>
  </slab-grid-list-item>
</slab-grid-list>
```

## Example

Here's a styled version, `<slab-styled-grid-list>`. 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.

```html
<slab-styled-grid-list label="Pour tickets" multiple>
  <slab-styled-grid-list-item label="Driveway" selected>
    <span>Driveway, 12 yards</span>
    <a href="#driveway">Ticket</a>
    <slab-styled-copy-button label="Copy number" value="T-4817"></slab-styled-copy-button>
  </slab-styled-grid-list-item>
  <slab-styled-grid-list-item label="Garage">
    <span>Garage, 18 yards</span>
    <a href="#garage">Ticket</a>
    <slab-styled-copy-button label="Copy number" value="T-4790"></slab-styled-copy-button>
  </slab-styled-grid-list-item>
  <slab-styled-grid-list-item label="Patio">
    <span>Patio, 8 yards</span>
    <a href="#patio">Ticket</a>
    <slab-styled-copy-button label="Copy number" value="T-4822"></slab-styled-copy-button>
  </slab-styled-grid-list-item>
  <slab-styled-grid-list-item disabled label="Walkway">
    <span>Walkway, not poured yet</span>
  </slab-styled-grid-list-item>
</slab-styled-grid-list>
```

Swap `slab-styled-` for `slab-` in that markup and you've got the same example as it ships: the headless elements with no CSS at all. That's your starting point.

Use a Grid List where each item in a list has controls of its own, such as a row of files, each with Share and Download. A Listbox's Options can't hold controls, and a plain list of them puts every control in the Tab order. A Grid List is reached by Tab once, and the arrow keys move between rows and between the controls in a row, as in React Aria's GridList and the APG's grid.

Each row takes the controls in it out of the Tab order with `tabindex="-1"`, Slab's own Checkbox and Copy Button included, so Tab leaves the Grid List rather than stopping at each. Give each row a `label` when it holds controls, so a screenreader reads "plan.pdf" rather than "plan.pdf Share Download".

Rows aren't selected unless `selectable` is set, or `multiple`, which allows more than one and needs no `selectable`. Then a click on a row, but not on a control in it, selects it, and Grid List dispatches "change". A design can draw a check box on `:state(selectable)` and fill it on `:state(selected)`, as the styled one does. It's only shown, since the row is what's selected and what a screenreader says is selected.

## Keyboard

| Key          | What it does                                                                               |
| ------------ | ------------------------------------------------------------------------------------------ |
| Tab          | Reaches the row focus was last in, or else the first selected or first row, then leaves.   |
| Down, Up     | Moves to the next or previous row, skipping disabled ones, from a row or a control in one. |
| Home, End    | Moves to the first or last row.                                                            |
| Right, Left  | Moves from a row to each of its controls and back to the row. Swapped right to left.       |
| Escape       | Moves from a control back to its row.                                                      |
| A character  | Moves to the next row whose text starts with what's typed.                                 |
| Enter, Space | Selects the row, or toggles it when `multiple`. Does nothing unless rows are selectable.   |

A control that edits text, such as a text `<input>`, keeps its arrow keys,
Home and End, so Escape is the way back to its row. With `multiple`, Shift
with Up or Down moves and toggles, Shift with Space selects from the last
selected row to the focused one, Control or Command with Shift and Home or
End selects from the focused row to the first or last, and Control or
Command with A selects every row, or none.

## Behavior

### `<slab-grid-list>`

A Grid List with no visual styles: a `[role=grid]` of rows, Grid List Items, that can hold controls of their own, such as a Checkbox, buttons and links, and that can be selected.

It's a one-column APG grid, like React Aria's GridList. Tab reaches it once, on the row focus was last in, or else on the first selected row, or else on the first. Down and Up move focus between rows, skipping disabled ones, and Home and End, with or without Control or Command, go to the first and last. Right moves from a row to the first control in it, then to each control after that, and back to the row from the last. Left goes the other way. In a right-to-left Grid List, Left and Right swap. Escape moves from a control back to its row. Typing moves to the next row whose text starts with what's typed. A control that edits text, such as a text `<input>`, keeps its arrow keys, Home and End, and so does one that handles a key itself and cancels it.

Rows aren't selected unless `selectable` or `multiple` is set. Then Space, Enter and a click on a row, but not on a control in it, select the row, or toggle it when `multiple`, which makes rows selectable without `selectable`. With `multiple`, Shift with Down or Up moves and toggles, Shift with Space selects every row from the one last selected to the focused one, and Control or Command with Shift and Home or End selects every one from the focused row to the first or last, moving there. Control or Command with A selects every enabled row, or none when they all are already. These are the APG's keys for a multi-select grid.

Put controls in it that take focus themselves, such as `<button>`s, links and Slab's own Checkbox. Each row takes them out of the page's Tab order, so Tab leaves the Grid List rather than stopping at each.

Style it through its part, and each row through its part and states.

### `<slab-grid-list-item>`

A Grid List Item with no visual styles: one row of its Grid List, a `[role=row]` with a single `[role=gridcell]` around what's slotted into it, such as text, a Checkbox, buttons and links.

The row itself takes focus, and its Grid List moves focus between rows with the arrow keys. Left and Right move focus between the row and the controls in it. Those controls are taken out of the page's Tab order, with `tabindex="-1"`, so Tab leaves the Grid List rather than stopping at each.

It's named by its content, or by `label` when that's set, which it should be when there are controls in it, so a screenreader reads "Driveway" rather than "Driveway Details Remove".

Its Grid List sets `:state(active)` on the row focus was last in, and `:state(selectable)` on each row when it has `selectable` or `multiple`, so a design can draw a check box. It sets `:state(disabled)` and `:state(selected)` itself.

## API

### `<slab-grid-list>`

#### Attributes

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` (required) | `string` |  | Names the grid list. |
| `multiple` | `boolean` | `false` | Whether more than one row can be selected. Rows are selectable when it's set, without `selectable`. |
| `selectable` | `boolean` | `false` | Whether a row can be selected. |

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| `items` (read-only) | `GridListItem[]` | Its Grid List Items, in order. |
| `selectedItem` (read-only) | `GridListItem \| null` | The first selected item, or `null`. |
| `selectedItems` (read-only) | `GridListItem[]` | Every selected item, in order. |

#### Methods

| Signature | Description |
| --- | --- |
| `focus(options?: FocusOptions): void` | Focuses it, or the part of it that takes focus. |

#### Events

| Name | Type | Description |
| --- | --- | --- |
| `change` | `Event` | When the user changes its value, as a native control's does. Setting it from code doesn't dispatch it. |

#### Slots

| Name | Type | Description |
| --- | --- | --- |
| `(default)` | `GridListItem` |  |

#### CSS parts

| Name | Description |
| --- | --- |
| `grid` | The rows |

### `<slab-grid-list-item>`

#### Attributes

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `disabled` | `boolean` | `false` | Can't be focused or selected. The controls in it are yours to disable. |
| `label` | `string` |  | Names the row in place of its content, and is what typeahead matches against. |
| `selected` | `boolean` | `false` | Like Option's, the attribute is the default state and the property is the current one. Style `:state(selected)` rather than `[selected]`. |

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| `selectable` | `boolean` | Set by its Grid List. |
| `controls` (read-only) | `HTMLElement[]` | What in the row can take focus, in order, other than disabled controls. |
| `text` (read-only) | `string` | What typeahead matches against: its label, or its text when it has no label. |

#### Slots

| Name | Type | Description |
| --- | --- | --- |
| `(default)` | `Element \| string` | The row's content, and any controls in it |

#### CSS parts

| Name | Description |
| --- | --- |
| `cell` | Holds the content |

#### CSS states

| Name | Description |
| --- | --- |
| `:state(active)` | While it's the active one, which the keyboard moves through while focus stays on its container. |
| `:state(disabled)` | While it's disabled. |
| `:state(selectable)` | While its Grid List is selectable. |
| `:state(selected)` | While it's selected. |

## Copy and own it

`<slab-styled-grid-list>` 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.

### Lit

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.

#### TypeScript

These files are TypeScript, and `@customElement()` is one of Lit's decorators (TypeScript's experimental flavor). You'll need two options in your tsconfig, per [Lit's docs](https://lit.dev/docs/components/decorators/#decorators-typescript): `experimentalDecorators` to compile them, and `useDefineForClassFields` turned off so class fields don't stomp on the accessors Lit sets up.

```json
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "useDefineForClassFields": false
  }
}
```

Using plain JavaScript? Drop the types and register the class with `customElements.define()` instead of the decorator.

#### grid-list.ts

```ts
import { customElement } from 'lit/decorators.js';
import GridList from 'slab-elements/grid-list.js';
import styles from './grid-list.styles.js';
import tokens from './tokens.styles.js';

declare global {
  interface HTMLElementTagNameMap {
    'slab-styled-grid-list': StyledGridList;
  }
}

/**
 * Grid List, styled: its rows in an ink-bordered box, ruled off from each
 * other in chalk.
 */
@customElement('slab-styled-grid-list')
export default class StyledGridList extends GridList {
  static override styles = [tokens, styles];
}
```

#### grid-list.styles.ts

```ts
import { css } from 'lit';

/*
  Focus is on a row, or on a control in one, so the box has no focus style
  of its own.
*/
export default css`
  [part~='grid'] {
    background-color: var(--paper);
    border: var(--border);
    box-shadow: var(--shadow);
    color: var(--ink);
    font-family: var(--font-body);
  }
`;
```

#### grid-list.item.ts

```ts
import { customElement } from 'lit/decorators.js';
import GridListItem from 'slab-elements/grid-list.item.js';
import styles from './grid-list.item.styles.js';
import tokens from './tokens.styles.js';

declare global {
  interface HTMLElementTagNameMap {
    'slab-styled-grid-list-item': StyledGridListItem;
  }
}

/**
 * Grid List Item, styled: a row with a check box at its start when its Grid
 * List can select, filled with ember while it's selected. Its buttons are
 * small and quiet, and it's outlined in ember while it's focused.
 */
@customElement('slab-styled-grid-list-item')
export default class StyledGridListItem extends GridListItem {
  static override styles = [tokens, styles];
}
```

#### grid-list.item.styles.ts

```ts
import { css } from 'lit';

/*
  The row itself takes focus, so its outline is drawn inside it, where the
  rows around it and the Grid List's border can't cover it. The controls are
  the consumer's own, slotted in, so they're styled through "::slotted()".
*/
export default css`
  :host {
    cursor: default;
    transition: background-color 100ms;
  }

  :host(:not(:first-child)) {
    border-block-start: 2px solid var(--chalk);
  }

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

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

  :host(:state(selectable)) {
    cursor: pointer;
  }

  :host(:state(disabled)) {
    color: var(--ash);
    cursor: not-allowed;
  }

  [part~='cell'] {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    min-block-size: 2.75rem;
    padding: 0.375rem 0.75rem;
  }

  /*
    The check box, which only shows. The row is what's selected, and a
    screenreader hears that from it.
  */
  :host(:state(selectable)) [part~='cell']::before {
    block-size: 1rem;
    border: var(--border);
    box-sizing: border-box;
    content: '';
    flex: none;
    inline-size: 1rem;
  }

  /* Filled with ember, inside a ring of paper. */
  :host(:state(selectable):state(selected)) [part~='cell']::before {
    background: linear-gradient(var(--ember), var(--ember));
    border-color: var(--ember);
    box-shadow: inset 0 0 0 2px var(--paper);
  }

  :host(:state(selectable):state(disabled)) [part~='cell']::before {
    border-color: var(--ash);
  }

  /* What the row is about fills it, pushing the controls to its end. */
  ::slotted(:first-child) {
    flex: 1 1 auto;
    min-inline-size: 0;
  }

  ::slotted(button) {
    background-color: transparent;
    border: 2px solid var(--ink);
    color: var(--ink);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.125rem 0.5rem;
    text-transform: uppercase;
  }

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

  ::slotted(a) {
    color: var(--ember-deep);
    font-weight: 600;
  }

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

  @media (prefers-reduced-motion: reduce) {
    :host {
      transition: none;
    }
  }
`;
```

#### tokens.styles.ts

```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;
    }
  }
`;
```

### React, Vue, Svelte and Ember

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

In React and Vue, each component registers its headless element and imports its CSS. Use it like the element: its props are the element's attributes and properties.

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

In Ember, each component registers its headless element and imports its CSS. Use it like the element: its attributes and its content go to the element.

#### GridList.jsx

```jsx
import 'slab-elements/grid-list.js';
import './grid-list.css';
import 'slab-elements/grid-list.item.js';
import './grid-list.item.css';

export function GridList(props) {
  return <slab-grid-list {...props} />;
}

export function GridListItem(props) {
  return <slab-grid-list-item {...props} />;
}
```

#### GridList.vue

```vue
<script setup>
import 'slab-elements/grid-list.js';
import './grid-list.css';
</script>

<template>
  <slab-grid-list><slot /></slab-grid-list>
</template>
```

#### GridListItem.vue

```vue
<script setup>
import 'slab-elements/grid-list.item.js';
import './grid-list.item.css';
</script>

<template>
  <slab-grid-list-item><slot /></slab-grid-list-item>
</template>
```

#### grid-list.js

```js
import 'slab-elements/grid-list.js';
import './grid-list.css';
import 'slab-elements/grid-list.item.js';
import './grid-list.item.css';
```

#### GridList.gjs

```gjs
import 'slab-elements/grid-list.js';
import './grid-list.css';

export const GridList = <template>
  <slab-grid-list ...attributes>{{yield}}</slab-grid-list>
</template>;
```

#### GridListItem.gjs

```gjs
import 'slab-elements/grid-list.item.js';
import './grid-list.item.css';

export const GridListItem = <template>
  <slab-grid-list-item ...attributes>{{yield}}</slab-grid-list-item>
</template>;
```

#### grid-list.css

```css
slab-grid-list::part(grid) {
  background-color: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--font-body);
}
```

#### grid-list.item.css

```css
slab-grid-list-item {
  cursor: default;
  transition: background-color 100ms;
}

slab-grid-list-item:not(:first-child) {
  border-block-start: 2px solid var(--chalk);
}

slab-grid-list-item:hover {
  background-color: var(--chalk);
}

slab-grid-list-item:focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: -3px;
}

slab-grid-list-item:state(selectable) {
  cursor: pointer;
}

slab-grid-list-item:state(disabled) {
  color: var(--ash);
  cursor: not-allowed;
}

slab-grid-list-item::part(cell) {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-block-size: 2.75rem;
  padding: 0.375rem 0.75rem;
}

/*
  The check box, which only shows. The row is what's selected, and a
  screenreader hears that from it.
*/
slab-grid-list-item:state(selectable)::part(cell)::before {
  block-size: 1rem;
  border: var(--border);
  box-sizing: border-box;
  content: '';
  flex: none;
  inline-size: 1rem;
}

/* Filled with ember, inside a ring of paper. */
slab-grid-list-item:state(selectable):state(selected)::part(cell)::before {
  background: linear-gradient(var(--ember), var(--ember));
  border-color: var(--ember);
  box-shadow: inset 0 0 0 2px var(--paper);
}

slab-grid-list-item:state(selectable):state(disabled)::part(cell)::before {
  border-color: var(--ash);
}

/* What the row is about fills it, pushing the controls to its end. */
slab-grid-list-item > :first-child {
  flex: 1 1 auto;
  min-inline-size: 0;
}

slab-grid-list-item > button {
  background-color: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.125rem 0.5rem;
  text-transform: uppercase;
}

slab-grid-list-item > button:hover {
  background-color: var(--ink);
  color: var(--paper);
}

slab-grid-list-item > a {
  color: var(--ember-deep);
  font-weight: 600;
}

slab-grid-list-item > :focus-visible {
  outline: 3px solid var(--ember);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  slab-grid-list-item {
    transition: none;
  }
}
```

#### tokens.css

```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;
  }
}
```
