# Relief Integrations

> An integrations section as a wall of tool names: pick helpdesks, commerce, chat, CRM or data and every tool of that kind rises out of the wall, rippling from the tab you picked, with the count and a link to the full directory.

A Integrations Section block from KeyframeUI: a whole landing-page section built around the Relief component, free to install as source with the shadcn CLI. Built with React and Tailwind CSS.

- Live preview: https://keyframeui.com/blocks/integrations/relief-integrations
- Category: Integrations
- Built with: [Relief](https://keyframeui.com/components/relief.md)
- npm dependencies: clsx, tailwind-merge

## Installation

Register the @keyframeui registry in `components.json` once per project:

```json
{
  "registries": {
    "@keyframeui": "https://keyframeui.com/r/{name}.json"
  }
}
```

Then add the block. It lands in `components/relief-integrations.tsx`, and the CLI also adds the components it's built with (`components/ui/relief.tsx`) and `lib/utils.ts`, and installs the npm dependencies:

```bash
npx shadcn@latest add @keyframeui/relief-integrations
```

Or install by URL, without registering the namespace:

```bash
npx shadcn@latest add https://keyframeui.com/r/relief-integrations.json
```

## Usage

Put it where the section goes. The copy, links and data sit in constants at the top of the file; edit them there.

```tsx
import { ReliefIntegrations } from "@/components/relief-integrations";

export default function Page() {
  return <ReliefIntegrations />;
}
```

## Source

```tsx title="components/relief-integrations.tsx"
"use client";

import * as React from "react";

import { Relief, type ReliefWord } from "@/components/ui/relief";

/* ── Content ─────────────────────────────────────────────────
 * Everything you'd change to make the section yours: the copy,
 * the kinds of tool and the tools themselves. Picking a kind
 * raises every tool of that kind out of the wall; All lets the
 * wave run over the whole directory.
 * ─────────────────────────────────────────────────────────── */

/** The section's accent, for the count and the focus rings. Light and dark. */
const ACCENT = { light: "#7c3aed", dark: "#a78bfa" };
/** The wall's inks, low to high: deep indigo through violet and lilac to pink. */
const INKS = ["#1e1b4b", "#3b1d8f", "#6d28d9", "#a78bfa", "#f5f3ff", "#fbcfe8", "#ff5ca8", "#e0136f"];

const HEADLINE = "Sorrel answers where your customers already are.";
const LEDE =
  "Connect the helpdesk, store and chat you run today. Sorrel reads from each, writes back to each, and nobody changes tools.";
const DIRECTORY = { label: "Browse the directory", href: "https://sorrel.example/integrations" };

const KINDS = [
  { id: "all", label: "All" },
  { id: "helpdesks", label: "Helpdesks" },
  { id: "commerce", label: "Commerce" },
  { id: "chat", label: "Chat" },
  { id: "crm", label: "CRM" },
  { id: "data", label: "Data" },
] as const;

type Kind = (typeof KINDS)[number]["id"];

const TOOLS: Record<Exclude<Kind, "all">, string[]> = {
  helpdesks: ["Ticket desk", "Inbox", "Shared mail", "Help center", "Macros", "Queues", "SLA timer"],
  commerce: ["Storefront", "Orders", "Returns", "Payments", "Subscriptions", "Shipping", "Loyalty"],
  chat: ["Live chat", "SMS", "Voice", "Messaging", "Widget", "Social DMs"],
  crm: ["Contacts", "Accounts", "Deals", "Pipeline", "Notes", "Outreach"],
  data: ["Warehouse", "Sheets", "Webhooks", "API", "Exports", "Events", "Audit log"],
};

const WORDS: ReliefWord[] = Object.entries(TOOLS).flatMap(([kind, names]) => names.map((text) => ({ text, tags: [kind] })));

/* ── Section ─────────────────────────────────────────────── */

export function ReliefIntegrations() {
  const [kind, setKind] = React.useState<Kind>("all");
  const [origin, setOrigin] = React.useState<[number, number]>([0.5, 0.1]);
  const wallRef = React.useRef<HTMLDivElement>(null);
  const count = kind === "all" ? WORDS.length : TOOLS[kind].length;

  function pick(next: Kind, button: HTMLElement) {
    const wall = wallRef.current?.getBoundingClientRect();
    const box = button.getBoundingClientRect();
    if (wall) {
      // The rise ripples out from the tab that asked for it.
      setOrigin([
        (box.left + box.width / 2 - wall.left) / wall.width,
        (box.top + box.height / 2 - wall.top) / wall.height,
      ]);
    }
    setKind(next);
  }

  // Arrow keys move between kinds, as a radio group does.
  function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
    const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
    if (!step) return;
    event.preventDefault();
    const i = KINDS.findIndex((k) => k.id === kind);
    const next = KINDS[(i + step + KINDS.length) % KINDS.length];
    const button = event.currentTarget.querySelector<HTMLElement>(`[data-kind="${next.id}"]`);
    if (button) {
      button.focus();
      pick(next.id, button);
    }
  }

  return (
    <section
      style={{ "--accent": ACCENT.light, "--accent-dark": ACCENT.dark } as React.CSSProperties}
      className="bg-white text-zinc-950 dark:bg-[#09090b] dark:text-white"
    >
      <div className="mx-auto max-w-6xl px-6 pt-20 pb-6 text-center sm:pt-24">
        <h2 className="mx-auto max-w-2xl text-3xl leading-[1.08] font-semibold tracking-[-0.03em] text-balance sm:text-[2.6rem]">
          {HEADLINE}
        </h2>
        <p className="mx-auto mt-4 max-w-xl text-base leading-relaxed text-pretty text-zinc-600 dark:text-zinc-400">
          {LEDE}
        </p>
      </div>

      <div className="mx-auto max-w-6xl px-6 pb-20 sm:pb-24">
        <Relief
          ref={wallRef}
          words={WORDS}
          raise={kind === "all" ? null : kind}
          origin={origin}
          inks={INKS}
          seed="sorrel-integrations"
          label="Integrations directory"
          className="flex h-[26rem] w-full flex-col items-center rounded-2xl border border-zinc-200 bg-white p-3 sm:p-5 dark:border-white/10 dark:bg-[#07080c]"
          wordClassName="font-semibold text-zinc-400 dark:text-zinc-600"
        >
          <div
            data-relief-quiet
            className="flex w-full max-w-2xl flex-col items-center gap-3 rounded-2xl border border-zinc-200 bg-white p-2 shadow-[0_12px_40px_-12px_rgb(0_0_0/0.25)] sm:w-auto dark:border-white/10 dark:bg-[#0d0f16]"
          >
            <div
              role="radiogroup"
              aria-label="Kind of tool"
              onKeyDown={onKeyDown}
              className="flex max-w-full flex-wrap justify-center gap-1"
            >
              {KINDS.map((k) => {
                const on = k.id === kind;
                return (
                  <button
                    key={k.id}
                    type="button"
                    role="radio"
                    aria-checked={on}
                    tabIndex={on ? 0 : -1}
                    data-kind={k.id}
                    onClick={(event) => pick(k.id, event.currentTarget)}
                    className={`h-8 rounded-full px-3.5 text-sm font-medium transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)] dark:focus-visible:outline-[var(--accent-dark)] ${
                      on
                        ? "bg-zinc-950 text-white dark:bg-white dark:text-zinc-950"
                        : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-white/10"
                    }`}
                  >
                    {k.label}
                  </button>
                );
              })}
            </div>
            <div className="flex w-full items-center justify-between gap-4 border-t border-zinc-100 px-2.5 pt-2 pb-1 text-sm dark:border-white/5">
              <p aria-live="polite" className="tabular-nums text-zinc-600 dark:text-zinc-400">
                <span className="font-medium text-[var(--accent)] dark:text-[var(--accent-dark)]">{count} tools</span>
                {kind === "all" ? " connected" : ` in ${KINDS.find((k) => k.id === kind)?.label}`}
              </p>
              <a
                href={DIRECTORY.href}
                className="inline-flex items-center gap-1 rounded-sm font-medium whitespace-nowrap text-zinc-950 transition-colors duration-150 hover:text-[var(--accent)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)] dark:text-white dark:hover:text-[var(--accent-dark)] dark:focus-visible:outline-[var(--accent-dark)]"
              >
                {DIRECTORY.label}
                <span aria-hidden>→</span>
              </a>
            </div>
          </div>
        </Relief>
      </div>
    </section>
  );
}
```
