# Linear Queue

The agent's todo list, split into what is left and what is done.

Build a Queue in this project that looks and behaves like Linear's. Measured from the running Linear app (linear.app). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.

Fidelity: Concept, not a real feature. Designed from Linear's grouped issue list: the group header band, issue rows and the todo status ring. Row hairlines use the secondary border in dark so they stay visible.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--border-primary` | `lch(95.24% 0 282)` | `lch(9.84% 1.48 272)` |
| `--border-secondary` | `lch(88.49% 0 282)` | `lch(14.16% 1.48 272)` |
| `--text-primary` | `lch(9.794% 0 282)` | `lch(100% 0 272)` |
| `--text-secondary` | `lch(19.588% 1.25 282)` | `lch(90.451% 1.2 272)` |
| `--text-tertiary` | `lch(39.176% 1.25 282)` | `lch(61.803% 1.2 272)` |
| `--accent` | `lch(53% 52.26 286.91)` | `lch(47.918% 59.303 288.421)` |
| `--accent-text` | `lch(100% 5 286.91)` | `lch(100% 5 288.421)` |
| `--card-bg` | `lch(100% 0 282)` | `lch(9.345% 0.85 272)` |
| `--card-ring` | `lch(0% 0 0 / 0.088)` | `lch(100% 0 0 / 0.083)` |
| `--fill-subtle` | `lch(0% 0 0 / 0.032)` | `lch(100% 0 0 / 0.035)` |
| `--fill-muted` | `lch(0% 0 0 / 0.055)` | `lch(100% 0 0 / 0.065)` |
| `--status-todo` | `lch(66% 1 282)` | `lch(56% 1.2 272)` |
| `--shadow-low` | `lch(0% 0 0 / 0.02) 0 3px 6px -2px, lch(0% 0 0 / 0.04) 0 1px 1px 0` | `lch(0% 0 0 / 0.3) 0 0.5px 1px 1px` |
| `--focus-ring` | `#5e69d1` | `#5e69d1` |
| `--font-size-small` | `0.8125rem` | `0.8125rem` |
| `--font-weight-medium` | `500` | `500` |
| `--radius-rounded` | `9999px` | `9999px` |
| `--speed-highlight-fade-in` | `0s` | `0s` |
| `--speed-quick` | `0.1s` | `0.1s` |
| `--speed-highlight-fade-out` | `0.15s` | `0.15s` |
| `--ease-spring-collapse` | `linear(0, 0.0183, 0.0632, 0.1233, 0.191, 0.2611, 0.3304, 0.3969, 0.4593, 0.517, 0.5698, 0.6177, 0.6608, 0.6996, 0.7342, 0.7651, 0.7925, 0.8169, 0.8384, 0.8575, 0.8744, 0.8893, 0.9025, 0.9141, 0.9243, 0.9333, 0.9413, 0.9483, 0.9545, 0.9599, 0.9647, 0.9689, 0.9726, 0.9759, 0.9788, 0.9813, 0.9836, 0.9855, 0.9873, 0.9888, 1)` | `linear(0, 0.0183, 0.0632, 0.1233, 0.191, 0.2611, 0.3304, 0.3969, 0.4593, 0.517, 0.5698, 0.6177, 0.6608, 0.6996, 0.7342, 0.7651, 0.7925, 0.8169, 0.8384, 0.8575, 0.8744, 0.8893, 0.9025, 0.9141, 0.9243, 0.9333, 0.9413, 0.9483, 0.9545, 0.9599, 0.9647, 0.9689, 0.9726, 0.9759, 0.9788, 0.9813, 0.9836, 0.9855, 0.9873, 0.9888, 1)` |
| `--duration-spring-collapse` | `185ms` | `185ms` |

## CSS

Scoped under `[data-style="linear"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="linear"] {
  .ui-queue {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border-radius: 10px;
    background-color: var(--card-bg);
    box-shadow:
      0 0 0 0.5px var(--card-ring),
      var(--shadow-low);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: var(--font-size-small);
    line-height: 20px;
  }

  .ui-queue-section {
    display: flex;
    flex-direction: column;
  }

  .ui-queue-section + .ui-queue-section {
    border-top: 0.5px solid var(--border-secondary);
  }

  .ui-queue-section-trigger {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0 14px 0 12px;
    border: none;
    background-color: var(--fill-subtle);
    color: var(--text-primary);
    font: inherit;
    text-align: start;
    user-select: none;
    cursor: default;
    transition: background-color var(--speed-highlight-fade-out);

    @media (hover: hover) {
      &:hover {
        background-color: var(--fill-muted);
        transition-duration: var(--speed-highlight-fade-in);
      }
    }

    &:focus-visible {
      outline: 1px solid var(--focus-ring);
      outline-offset: -1px;
    }
  }

  .ui-queue-chevron {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    background-color: var(--text-tertiary);
    clip-path: polygon(25% 12%, 85% 50%, 25% 88%);
    transition: transform var(--speed-quick) ease-in-out;

    & path {
      display: none;
    }

    [data-panel-open] > & {
      transform: rotate(90deg);
    }
  }

  .ui-queue-section-label {
    min-width: 0;
    overflow: hidden;
    font-weight: var(--font-weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-queue-section-count {
    flex-shrink: 0;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
  }

  .ui-queue-section-content {
    box-sizing: border-box;
    height: var(--collapsible-panel-height);
    overflow: hidden;
    transition: height var(--duration-spring-collapse) var(--ease-spring-collapse);

    &[data-starting-style],
    &[data-ending-style] {
      height: 0;
    }
  }

  .ui-queue-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ui-queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    height: 40px;
    padding: 0 14px 0 28px;
    border-top: 0.5px solid var(--border-primary);
    box-sizing: border-box;
    transition: background-color var(--speed-highlight-fade-out);

    @media (hover: hover) {
      &:hover {
        background-color: var(--fill-subtle);
        transition-duration: var(--speed-highlight-fade-in);
      }
    }
  }

  .ui-queue-item-indicator {
    box-sizing: border-box;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--status-todo);
    border-radius: var(--radius-rounded);
    color: var(--accent-text);

    & svg {
      width: 12px;
      height: 12px;
      opacity: 0;
      stroke-width: 2;
    }
  }

  .ui-queue-item[data-done] .ui-queue-item-indicator {
    border: none;
    background-color: var(--accent);

    & svg {
      opacity: 1;
    }
  }

  .ui-queue-item-body {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
  }

  .ui-queue-item-label {
    flex-shrink: 0;
    max-width: 100%;
    overflow: hidden;
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-queue-item-description {
    min-width: 0;
    overflow: hidden;
    color: var(--text-tertiary);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-queue-item[data-done] .ui-queue-item-label {
    color: var(--text-tertiary);
  }

  &[data-theme="dark"] .ui-queue-item {
    border-top-color: var(--border-secondary);
  }

  @media (prefers-reduced-motion: reduce) {
    .ui-queue-chevron,
    .ui-queue-section-content {
      transition: none;
    }
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
import type { ComponentProps, ReactNode } from "react";
import { join } from "./utils";

function Root({ className, ...props }: ComponentProps<"div">) {
  return <div className={join("ui-queue", className)} {...props} />;
}

function Section({ className, ...props }: Omit<BaseCollapsible.Root.Props, "className"> & { className?: string }) {
  return <BaseCollapsible.Root className={join("ui-queue-section", className)} {...props} />;
}

type TriggerProps = Omit<BaseCollapsible.Trigger.Props, "className"> & {
  className?: string;
  count?: ReactNode;
};

function SectionTrigger({ className, count, children, ...props }: TriggerProps) {
  return (
    <BaseCollapsible.Trigger className={join("ui-queue-section-trigger", className)} {...props}>
      <svg className="ui-queue-chevron" viewBox="0 0 16 16" fill="none" aria-hidden>
        <path d="M6 4l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
      </svg>
      <span className="ui-queue-section-label">{children}</span>
      {count !== undefined ? <span className="ui-queue-section-count">{count}</span> : null}
    </BaseCollapsible.Trigger>
  );
}

function SectionContent({ className, ...props }: Omit<BaseCollapsible.Panel.Props, "className"> & { className?: string }) {
  return <BaseCollapsible.Panel className={join("ui-queue-section-content", className)} {...props} />;
}

function List({ className, ...props }: ComponentProps<"ul">) {
  return <ul className={join("ui-queue-list", className)} {...props} />;
}

type ItemProps = ComponentProps<"li"> & { done?: boolean; description?: ReactNode };

function Item({ className, done = false, description, children, ...props }: ItemProps) {
  return (
    <li className={join("ui-queue-item", className)} data-done={done || undefined} {...props}>
      <span className="ui-queue-item-indicator" aria-hidden>
        <svg viewBox="0 0 16 16" fill="none">
          <path d="M5 8.25l2 2 4-4.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
        </svg>
      </span>
      <span className="ui-queue-item-body">
        <span className="ui-queue-item-label">{children}</span>
        {description ? <span className="ui-queue-item-description">{description}</span> : null}
      </span>
    </li>
  );
}

export const Queue = {
  Root,
  Section,
  SectionTrigger,
  SectionContent,
  List,
  Item,
};
```

## Example

```tsx
import { Queue } from "@replicas/ui";

export default function QueueDemo() {
  return (
    <Queue.Root style={{ width: "100%", maxWidth: 420 }}>
      <Queue.Section defaultOpen>
        <Queue.SectionTrigger count={3}>To do</Queue.SectionTrigger>
        <Queue.SectionContent>
          <Queue.List>
            <Queue.Item description="It's clipped by the overflow on the field.">
              Fix the focus ring on the select trigger
            </Queue.Item>
            <Queue.Item>Update the snapshots</Queue.Item>
            <Queue.Item description="Typing, clearing and keyboard selection.">Add tests for the combobox</Queue.Item>
          </Queue.List>
        </Queue.SectionContent>
      </Queue.Section>
      <Queue.Section>
        <Queue.SectionTrigger count={2}>Completed</Queue.SectionTrigger>
        <Queue.SectionContent>
          <Queue.List>
            <Queue.Item done>Write the migration guide</Queue.Item>
            <Queue.Item done>Add a changeset</Queue.Item>
          </Queue.List>
        </Queue.SectionContent>
      </Queue.Section>
    </Queue.Root>
  );
}
```

## Foundations

The rest of the Linear style, as a skill: https://replicas.raphaelsalaja.com/skills/linear/SKILL.md