BLK-44Blocks

Comparison Table UI | Responsive Us-vs-Others Comparison with a Highlighted Column, React

A React + Tailwind CSS comparison table (no dependencies): on desktop all three parties sit side by side; on phones you switch the counterpart and read it against your own column in two columns. One dataset (6 criteria × us, an agency and a freelancer) drives four layouts via the layout prop — Auto, All three, Switch, and a sticky-column horizontal-swipe <table> — and a sample switch lets you compare when to use each. Every cell is split into a short point and a detail; points share the same size and weight for everyone, and only your column is emphasised by a single amber pillar drawn on a grid overlaid on the body grid. On narrow screens the switcher and an "Us | selected counterpart" header stick to the top, so you can change the counterpart where you are reading. Switching keeps your column and the scroll position and marks only the changed counterpart cells with a 180ms background change (stopped under prefers-reduced-motion). The switcher is a radiogroup with arrow keys and Home/End. The last row states where each option fits, with notes that the comparison describes types of setup rather than specific companies and on the written terms required when a business commissions a freelancer in Japan (checked on the Japan Fair Trade Commission page).

Preview

表示例

BLK-44 / 依頼先の比較

依頼先で変わるのは、価格だけではありません

比較する相手

  • 見積りの出し方何が含まれるか

    当社:含まないものまで1行ずつ書く画面数と機能を並べ、範囲外の作業も同じ表に書いて出します。追加が出たら金額と納期の差分をその場でお伝えします。
    制作会社:一式の金額でまとまりやすい含む・含まないの線は、着手後の打ち合わせで固まることがあります。
  • 進行の窓口誰と話すか

    当社:話す人と作る人が同じ仕様の意図が伝言で薄まらないので、判断が要る場面でも往復が1回で済みます。
    制作会社:窓口と実装は別の担当窓口はディレクターで、細かい仕様は人を介して実装の担当へ伝わります。
  • 任せられる範囲設計から運用まで

    当社:設計から計測まで同じ担当情報設計・デザイン・実装・公開後の計測まで担当が変わらないので、決めた理由がそのまま残ります。
    制作会社:工程ごとに専門の担当各工程は厚い一方、前の工程で何を捨てたかは要約されて次へ渡ります。
  • 公開したあと更新と改善

    当社:直せる場所を一覧で渡すどこまで自分で編集できるかを公開前に合意し、数字を見て次を決める場も一緒に用意します。
    制作会社:保守は別契約が多い軽微な差し替えでも、見積りと順番待ちが挟まることがあります。
  • もしもの時引き継ぎと停止

    当社:権限は最初からお客様名義サーバー・ドメイン・管理画面をお客様名義で用意し、作ったものは全て引き渡します。他社へ移す判断もできます。
    制作会社:移管は契約しだい環境が制作側の管理下にあると、移せるかどうかが契約の条項に左右されます。
  • 向いている場面選び分けの目安

    当社:小さく作って育てたいとき決める人と作る人の距離が近いほど、判断の速さがそのまま品質になります。
    制作会社:部署の多い大規模な案件分業の厚みと、同時に動ける人数がそのまま強みになります。

制作会社=営業・進行・実装が分かれた分業の体制、フリーランス=個人が単独で請け負う体制。比較対象は特定の企業ではなく、体制の一般的な傾向を示したものです。実際の進め方は個々の相手によって異なります。

※1 特定受託事業者に係る取引の適正化等に関する法律(フリーランス・事業者間取引適正化等法、2024年11月1日施行)の「取引条件の明示」。出典: 公正取引委員会「フリーランスの取引適正化に向けた公正取引委員会の取組」(2026-11-11 確認)

体制について相談する

自動:既定。672px以上は3者を横並び、狭い幅は相手を1者ずつ切り替えて当社と2列で突き合わせます。

<CompareUsVsOthers />
Share on X

Read the full description

A React + Tailwind CSS comparison table (no dependencies): on desktop all three parties sit side by side; on phones you switch the counterpart and read it against your own column in two columns. One dataset (6 criteria × us, an agency and a freelancer) drives four layouts via the layout prop — Auto, All three, Switch, and a sticky-column horizontal-swipe <table> — and a sample switch lets you compare when to use each. Every cell is split into a short point and a detail; points share the same size and weight for everyone, and only your column is emphasised by a single amber pillar drawn on a grid overlaid on the body grid. On narrow screens the switcher and an "Us | selected counterpart" header stick to the top, so you can change the counterpart where you are reading. Switching keeps your column and the scroll position and marks only the changed counterpart cells with a 180ms background change (stopped under prefers-reduced-motion). The switcher is a radiogroup with arrow keys and Home/End. The last row states where each option fits, with notes that the comparison describes types of setup rather than specific companies and on the written terms required when a business commissions a freelancer in Japan (checked on the Japan Fair Trade Commission page).

Added:
2026-08-28
Updated:
2026-11-11
Dependencies:
None
tags
#block #comparison #comparison-table #responsive-table #sticky-column #horizontal-scroll #radiogroup #switcher #highlight-column #a11y #no-image #no-deps
"use client";

import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";

/**
 * 比較表UI|自社を強調するレスポンシブ比較(BLK-44)
 *
 * 1つの比較データ(観点 × 当社・相手2者)から、4つの見せ方を layout で選ぶ。
 * - "auto"(既定): 672px以上は3者を横並び、狭い幅は相手を1者ずつ切り替えて当社と2列で突き合わせる
 * - "matrix": どの幅でも3者を同時に出す。狭い幅では当社を上に、相手2者を下に2列で積む
 * - "switch": どの幅でも当社と相手1者だけを並べる。相手が多い・文が長いとき向け
 * - "scroll": <table> のまま先頭列を固定して横にスワイプさせる。表として読み上げられる
 *
 * 汎用技法メモ:
 *
 * 1. 「主役の列」は表のセル単位ではなく、同じグリッドを重ねた1枚の帯で作る
 *    本文と同じカラム定義・同じ gap のグリッドを absolute inset-0 でもう1枚重ね、
 *    当社の列に div を1つ置くだけで、行を足しても途切れない柱になる。
 *    "scroll" だけは <table> なので、列全体を1要素で塗れずセルごとに地色を配る(対比のため残している)。
 *
 * 2. 各セルは「要点」と「補足」に分け、要点の文字の大きさ・濃さを全員でそろえる
 *    相手側の文字を淡く小さくして主役化すると、同じ観点の差が拾いにくくなり比較の公平さも落ちる。
 *    当社の優先度は地色・縦罫・列見出しで付け、本文の読みやすさは全員同じにする。
 *
 * 3. 狭い幅の切替は sticky の帯に置き、列見出しを兼ねる
 *    帯の中に「当社|選択中の相手」の列見出しを並べるので、読み進めた位置でも誰と比べているかが分かり、
 *    その場で相手を替えられる。切替の前に「帯の下の最初の行」の位置を測り、描き替えた後に
 *    同じ位置へ戻す(overflow-anchor は切っておく。ブラウザの補正と二重にならないように)。
 *    帯の上端は、画面上部に固定されたサイトのヘッダー(position: sticky / fixed)の下端に合わせる。
 *
 * 4. 変わったのは相手側だけ、を地色の変化で示す
 *    相手のセルに key={相手id + 観点id} を与えて再マウントし、180ms の背景変化を1回だけ当てる。
 *    当社側は描き替えない。prefers-reduced-motion では止める(選択中の表示は列見出しと切替で分かる)。
 *
 * 5. 比較相手は radiogroup(タブではない)
 *    切り替わるのはパネルではなく「比較の設定」なので role="radio" の roving tabindex。
 *    矢印キーは左右と上下の両方、Home/End も受ける。
 *
 * 6. 比較の相手を貶さない
 *    最終行を「向いている場面」にして相手側にも利点を書き、「特定企業ではなく体制の傾向」の注記を添える。
 */

export type Layout = "auto" | "matrix" | "switch" | "scroll";

type Rival = {
  id: string;
  /** 切替と列見出しに出る名前(短く) */
  label: string;
  /** 注記に出す体制の説明 */
  note: string;
};

type Claim = {
  /** 要点(全員で同じ大きさ・濃さ) */
  point: string;
  /** 補足 */
  detail: string;
};

type Point = {
  id: string;
  /** 比較の観点(行の見出し) */
  axis: string;
  /** 観点の補足 */
  sub: string;
  ours: Claim;
  /** 相手ID → その相手について */
  rivals: Record<string, Claim>;
};

export const RIVALS: Rival[] = [
  { id: "agency", label: "制作会社", note: "営業・進行・実装が分かれた分業の体制" },
  { id: "freelance", label: "フリーランス", note: "個人が単独で請け負う体制" },
];

export const POINTS: Point[] = [
  {
    id: "estimate",
    axis: "見積りの出し方",
    sub: "何が含まれるか",
    ours: {
      point: "含まないものまで1行ずつ書く",
      detail: "画面数と機能を並べ、範囲外の作業も同じ表に書いて出します。追加が出たら金額と納期の差分をその場でお伝えします。",
    },
    rivals: {
      agency: {
        point: "一式の金額でまとまりやすい",
        detail: "含む・含まないの線は、着手後の打ち合わせで固まることがあります。",
      },
      freelance: {
        point: "すぐに答えてもらえる",
        detail: "相場感で早く返事がもらえる反面、範囲の線引きが口頭のまま進むことがあります。事業者が発注するときは、業務の内容・報酬の額・支払期日などを書面かメール等で示す決まりがあります(※1)。",
      },
    },
  },
  {
    id: "contact",
    axis: "進行の窓口",
    sub: "誰と話すか",
    ours: {
      point: "話す人と作る人が同じ",
      detail: "仕様の意図が伝言で薄まらないので、判断が要る場面でも往復が1回で済みます。",
    },
    rivals: {
      agency: {
        point: "窓口と実装は別の担当",
        detail: "窓口はディレクターで、細かい仕様は人を介して実装の担当へ伝わります。",
      },
      freelance: {
        point: "本人と直接話せる",
        detail: "稼働が他の案件と重なると、返信の間隔が読みにくくなります。",
      },
    },
  },
  {
    id: "scope",
    axis: "任せられる範囲",
    sub: "設計から運用まで",
    ours: {
      point: "設計から計測まで同じ担当",
      detail: "情報設計・デザイン・実装・公開後の計測まで担当が変わらないので、決めた理由がそのまま残ります。",
    },
    rivals: {
      agency: {
        point: "工程ごとに専門の担当",
        detail: "各工程は厚い一方、前の工程で何を捨てたかは要約されて次へ渡ります。",
      },
      freelance: {
        point: "得意な工程は速い",
        detail: "設計から運用まで通すと、守備範囲を超える場面が出ます。",
      },
    },
  },
  {
    id: "after",
    axis: "公開したあと",
    sub: "更新と改善",
    ours: {
      point: "直せる場所を一覧で渡す",
      detail: "どこまで自分で編集できるかを公開前に合意し、数字を見て次を決める場も一緒に用意します。",
    },
    rivals: {
      agency: {
        point: "保守は別契約が多い",
        detail: "軽微な差し替えでも、見積りと順番待ちが挟まることがあります。",
      },
      freelance: {
        point: "小さな修正は速い",
        detail: "体制が1人なので、長く続く窓口としては続きにくい場合があります。",
      },
    },
  },
  {
    id: "handover",
    axis: "もしもの時",
    sub: "引き継ぎと停止",
    ours: {
      point: "権限は最初からお客様名義",
      detail: "サーバー・ドメイン・管理画面をお客様名義で用意し、作ったものは全て引き渡します。他社へ移す判断もできます。",
    },
    rivals: {
      agency: {
        point: "移管は契約しだい",
        detail: "環境が制作側の管理下にあると、移せるかどうかが契約の条項に左右されます。",
      },
      freelance: {
        point: "資産の置き場で差が出る",
        detail: "連絡が途絶えると、引き継ぎ先を探すところから始まります。",
      },
    },
  },
  {
    id: "fit",
    axis: "向いている場面",
    sub: "選び分けの目安",
    ours: {
      point: "小さく作って育てたいとき",
      detail: "決める人と作る人の距離が近いほど、判断の速さがそのまま品質になります。",
    },
    rivals: {
      agency: {
        point: "部署の多い大規模な案件",
        detail: "分業の厚みと、同時に動ける人数がそのまま強みになります。",
      },
      freelance: {
        point: "範囲が決まった単発の依頼",
        detail: "作るものが最初から決まっていれば、速さと費用で有利です。",
      },
    },
  },
];

const LAYOUTS: { id: Layout; label: string; code: string; use: string }[] = [
  {
    id: "auto",
    label: "自動",
    code: "<CompareUsVsOthers />",
    use: "既定。672px以上は3者を横並び、狭い幅は相手を1者ずつ切り替えて当社と2列で突き合わせます。",
  },
  {
    id: "matrix",
    label: "3者同時",
    code: '<CompareUsVsOthers layout="matrix" />',
    use: "全員を一度に見せたいとき。狭い幅では当社を上に、相手2者を下に2列で積みます。",
  },
  {
    id: "switch",
    label: "相手切替",
    code: '<CompareUsVsOthers layout="switch" />',
    use: "相手が多い・文が長いとき。どの幅でも当社と相手1者だけを並べます。",
  },
  {
    id: "scroll",
    label: "固定列",
    code: '<CompareUsVsOthers layout="scroll" />',
    use: "<table> のまま先頭列を固定して横にスワイプ。表として読み上げられる一方、狭い幅では右の列が画面の外に出ます。",
  },
];

const focusRing =
  "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-600";

/** 3者を横並びにする幅の列定義(本文・列見出し・柱の帯で共有する) */
const WIDE3 =
  "@2xl:grid-cols-[minmax(0,0.8fr)_minmax(0,1.25fr)_minmax(0,1fr)_minmax(0,1fr)] @2xl:gap-x-4";

export function CompareUsVsOthers({
  layout: initialLayout = "auto",
  showControls = true,
  rivals = RIVALS,
  points = POINTS,
  stickyTop,
}: {
  layout?: Layout;
  /** 表示例の切替(ギャラリーの見本用)。自社サイトに置くときは false */
  showControls?: boolean;
  rivals?: Rival[];
  points?: Point[];
  /** 固定の帯の上端(px)。省くと、画面上部に固定されたヘッダーを探してその下に置く */
  stickyTop?: number;
  headingTag?: "h1" | "p";
}) {
  const headingId = useId();
  const switcherId = useId();
  const [layout, setLayout] = useState<Layout>(initialLayout);
  const [rivalId, setRivalId] = useState(rivals[0].id);
  const [swaps, setSwaps] = useState(0);
  const [drawn, setDrawn] = useState(false);
  const [barTop, setBarTop] = useState(stickyTop ?? 0);
  const stageRef = useRef<HTMLDivElement | null>(null);
  const barRef = useRef<HTMLDivElement | null>(null);
  const listRef = useRef<HTMLUListElement | null>(null);
  const chipRefs = useRef<(HTMLButtonElement | null)[]>([]);
  const anchorRef = useRef<{ el: Element; top: number } | null>(null);

  const rival = rivals.find((item) => item.id === rivalId) ?? rivals[0];
  const current = LAYOUTS.find((item) => item.id === layout) ?? LAYOUTS[0];
  const three = layout === "auto" || layout === "matrix";

  useEffect(() => {
    const node = stageRef.current;
    if (!node || typeof IntersectionObserver === "undefined") {
      setDrawn(true);
      return;
    }
    const observer = new IntersectionObserver(
      (entries) => {
        if (entries.some((entry) => entry.isIntersecting)) {
          setDrawn(true);
          observer.disconnect();
        }
      },
      { threshold: 0.2 },
    );
    observer.observe(node);
    return () => observer.disconnect();
  }, [layout]);

  // サイトのヘッダーが上部に固定されていると帯が隠れるので、その下端に合わせる
  useEffect(() => {
    // 位置を渡されたときは測らずにその値を使う(描画時に stickyTop ?? barTop で決める)
    if (stickyTop != null) return;
    function measure() {
      let bottom = 0;
      for (const hit of document.elementsFromPoint(window.innerWidth / 2, 1)) {
        if (barRef.current?.contains(hit)) continue;
        for (let node: Element | null = hit; node && node !== document.body; node = node.parentElement) {
          const position = getComputedStyle(node).position;
          const rect = node.getBoundingClientRect();
          if ((position === "sticky" || position === "fixed") && rect.top <= 1) {
            bottom = Math.max(bottom, Math.round(rect.bottom));
            break;
          }
        }
      }
      setBarTop(bottom);
    }
    measure();
    window.addEventListener("resize", measure);
    return () => window.removeEventListener("resize", measure);
  }, [stickyTop]);

  // 切替の前に測った行を、描き替えた後も同じ高さに戻す(読んでいた位置を保つ)
  useLayoutEffect(() => {
    const anchor = anchorRef.current;
    anchorRef.current = null;
    if (!anchor) return;
    const delta = anchor.el.getBoundingClientRect().top - anchor.top;
    if (Math.abs(delta) > 0.5) window.scrollBy(0, delta);
  }, [rivalId]);

  function choose(next: string) {
    if (next === rivalId) return;
    const barBottom = barRef.current?.getBoundingClientRect().bottom ?? 0;
    for (const row of Array.from(listRef.current?.children ?? [])) {
      const rect = row.getBoundingClientRect();
      if (rect.bottom > barBottom) {
        anchorRef.current = { el: row, top: rect.top };
        break;
      }
    }
    setRivalId(next);
    setSwaps((n) => n + 1);
  }

  function moveTo(next: number) {
    const target = (next + rivals.length) % rivals.length;
    choose(rivals[target].id);
    chipRefs.current[target]?.focus();
  }

  function handleKeyDown(event: React.KeyboardEvent<HTMLButtonElement>, index: number) {
    const keys: Record<string, number> = {
      ArrowRight: index + 1,
      ArrowDown: index + 1,
      ArrowLeft: index - 1,
      ArrowUp: index - 1,
      Home: 0,
      End: rivals.length - 1,
    };
    if (event.key in keys) {
      event.preventDefault();
      moveTo(keys[event.key]);
    }
  }

  const rowGrid =
    layout === "switch"
      ? "grid-cols-2 @2xl:grid-cols-12 @2xl:gap-x-6"
      : `grid-cols-2 ${WIDE3}`;
  const axisSpan = layout === "switch" ? "col-span-2 @2xl:col-span-3" : "col-span-2 @2xl:col-span-1";
  const oursSpan =
    layout === "switch"
      ? "@2xl:col-span-5 @2xl:col-start-4"
      : layout === "matrix"
        ? "col-span-2 @2xl:col-span-1"
        : "";
  const rivalSpan = layout === "switch" ? "@2xl:col-span-4 @2xl:col-start-9" : "";
  /** 狭い幅で列見出しを帯に出すか(matrix は各セルに名前を出す) */
  const narrowHeads = layout !== "matrix";
  const chips = layout === "switch" ? "flex" : layout === "auto" ? "flex @2xl:hidden" : "hidden";

  return (
    <section
      aria-labelledby={headingId}
      className="@container w-full max-w-[900px] bg-white px-1 text-gray-900 [overflow-anchor:none]"
    >
      {showControls && (
        <div className="mb-4 border-b border-dashed border-gray-300 pb-2.5">
          <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
            <p id={`${switcherId}-layout`} className="text-[11px] font-bold text-gray-500">
              表示例
            </p>
            <div role="group" aria-labelledby={`${switcherId}-layout`} className="flex flex-wrap gap-1">
              {LAYOUTS.map((item) => (
                <button
                  key={item.id}
                  type="button"
                  aria-pressed={item.id === layout}
                  onClick={() => setLayout(item.id)}
                  className={`min-h-9 border px-2.5 text-[12px] font-semibold transition-[color,background-color,border-color] duration-150 ${focusRing} ${
                    item.id === layout
                      ? "border-gray-900 bg-gray-900 text-white"
                      : "border-gray-300 bg-white text-gray-700 hover:border-gray-900"
                  }`}
                >
                  {item.label}
                </button>
              ))}
            </div>
            <code className="hidden font-mono text-[11px] text-gray-600 @2xl:inline">{current.code}</code>
          </div>
        </div>
      )}

      <header className="border-l-2 border-amber-600 pl-4 @2xl:pl-6">
        <p className="text-[11px] leading-none text-gray-500">BLK-44 / 依頼先の比較</p>
        <h2
          id={headingId}
          className="mt-2.5 text-[22px] leading-[1.45] font-bold tracking-tight text-gray-900 @2xl:text-[clamp(1.6rem,3.4vw,2.2rem)]"
        >
          <span className="inline-block">依頼先で変わるのは、</span>
          <span className="inline-block">価格だけではありません</span>
        </h2>
        <p className="mt-3 hidden max-w-[40em] text-[14px] leading-[1.9] text-gray-600 @2xl:block">
          制作会社もフリーランスも、向いている場面があります。同じ6つの観点で、当社との違いを並べました。
        </p>
      </header>

      {layout === "scroll" ? (
        <ScrollTable rivals={rivals} points={points} />
      ) : (
        <>
          <div
            ref={barRef}
            style={{ top: stickyTop ?? barTop }}
            className={`sticky z-10 mt-4 border-b border-gray-900 bg-white/95 pt-3 backdrop-blur-sm @2xl:mt-7 ${
              narrowHeads ? "" : "hidden @2xl:block"
            }`}
          >
            <div className={`${chips} flex-wrap items-center gap-x-3 gap-y-2 pb-3`}>
              <p id={switcherId} className="text-[12px] font-bold text-gray-600">
                比較する相手
              </p>
              <div role="radiogroup" aria-labelledby={switcherId} className="flex flex-wrap gap-1.5">
                {rivals.map((item, index) => {
                  const selected = item.id === rival.id;
                  return (
                    <button
                      key={item.id}
                      ref={(node) => {
                        chipRefs.current[index] = node;
                      }}
                      type="button"
                      role="radio"
                      aria-checked={selected}
                      tabIndex={selected ? 0 : -1}
                      onClick={() => choose(item.id)}
                      onKeyDown={(event) => handleKeyDown(event, index)}
                      className={`min-h-10 border px-3.5 text-[13px] font-semibold transition-[color,background-color,border-color] duration-150 ${focusRing} ${
                        selected
                          ? "border-gray-900 bg-gray-900 text-white"
                          : "border-gray-300 bg-white text-gray-700 hover:border-gray-900 hover:text-gray-900"
                      }`}
                    >
                      {item.label}
                    </button>
                  );
                })}
              </div>
            </div>

            {/* 列見出し(狭い幅では「当社|選択中の相手」、広い幅では観点と全員) */}
            <div aria-hidden="true" className={`grid gap-x-3 ${rowGrid}`}>
              <p className={`hidden pb-2 text-[11px] text-gray-500 @2xl:block ${layout === "switch" ? "@2xl:col-span-3" : ""}`}>
                比較の観点
              </p>
              <p
                className={`border-t-2 border-amber-600 bg-amber-50 px-3 py-2 text-[13px] font-bold text-amber-800 @2xl:px-5 ${oursSpan}`}
              >
                当社
              </p>
              {rivals.map((item) => {
                const selected = item.id === rival.id;
                const visible = layout === "switch" ? (selected ? "" : "hidden") : selected ? "" : "hidden @2xl:block";
                return (
                  <p
                    key={`${item.id}-${selected && swaps > 0 ? swaps : 0}`}
                    className={`border-t-2 border-gray-300 px-3 py-2 text-[13px] font-bold text-gray-800 ${rivalSpan} ${visible} ${
                      selected && swaps > 0 ? "blk44-swap" : ""
                    }`}
                  >
                    {item.label}
                  </p>
                );
              })}
            </div>
          </div>

          <div ref={stageRef} className="relative">
            {/* 当社の柱: 本文と同じ列定義・同じgapのグリッドを重ねて1枚の帯で塗る */}
            <div
              aria-hidden="true"
              className={`pointer-events-none absolute inset-0 hidden @2xl:grid ${rowGrid}`}
            >
              <div className={`relative bg-amber-50 ${layout === "switch" ? "col-span-5 col-start-4" : "col-start-2"}`}>
                <span
                  className={`absolute inset-y-0 left-0 w-0.5 origin-top bg-amber-600 transition-transform duration-[900ms] ease-out motion-reduce:scale-y-100 motion-reduce:transition-none ${
                    drawn ? "scale-y-100" : "scale-y-0"
                  }`}
                />
              </div>
            </div>

            <ul ref={listRef} className="relative border-b border-gray-200">
              {points.map((point, index) => (
                <li
                  key={point.id}
                  className={`grid gap-x-3 gap-y-2 py-4 @2xl:gap-y-0 @2xl:py-6 ${rowGrid} ${
                    index === 0 ? "" : "border-t border-gray-200"
                  }`}
                >
                  <h3 className={`text-[13px] leading-[1.6] font-bold text-gray-900 ${axisSpan}`}>
                    {point.axis}
                    <span className="ml-2 text-[11px] font-normal text-gray-500 @2xl:mt-0.5 @2xl:ml-0 @2xl:block">
                      {point.sub}
                    </span>
                  </h3>

                  <div
                    className={`border-l-2 border-amber-600 bg-amber-50 px-3 py-2.5 @2xl:border-l-0 @2xl:bg-transparent @2xl:px-5 @2xl:py-0 ${oursSpan}`}
                  >
                    <ClaimText who="当社" claim={point.ours} showName={!narrowHeads} tone="ours" />
                  </div>

                  {rivals.map((item) => {
                    const selected = item.id === rival.id;
                    if (layout === "switch" && !selected) return null;
                    const visible = layout === "auto" && !selected ? "hidden @2xl:block" : "";
                    return (
                      <div
                        key={`${item.id}-${point.id}-${selected && swaps > 0 ? swaps : 0}`}
                        className={`border-l border-gray-300 px-3 py-2.5 @2xl:border-l-0 @2xl:px-3 @2xl:py-0 ${rivalSpan} ${visible} ${
                          selected && swaps > 0 ? "blk44-swap" : ""
                        }`}
                      >
                        <ClaimText who={item.label} claim={point.rivals[item.id]} showName={!narrowHeads} />
                      </div>
                    );
                  })}
                </li>
              ))}
            </ul>
          </div>
        </>
      )}

      <div className="mt-6 flex flex-col gap-5 @2xl:flex-row @2xl:items-end @2xl:justify-between">
        <div className="max-w-[60ch] space-y-1.5 text-[11px] leading-[1.85] text-gray-500">
          <p>
            {rivals.map((item) => `${item.label}=${item.note}`).join("、")}。比較対象は特定の企業ではなく、体制の一般的な傾向を示したものです。実際の進め方は個々の相手によって異なります。
          </p>
          <p>
            ※1 特定受託事業者に係る取引の適正化等に関する法律(フリーランス・事業者間取引適正化等法、2024年11月1日施行)の「取引条件の明示」。出典:{" "}
            <a
              href="https://www.jftc.go.jp/fllaw_limited.html"
              target="_blank"
              rel="noreferrer"
              className={`underline underline-offset-2 hover:text-gray-800 ${focusRing}`}
            >
              公正取引委員会「フリーランスの取引適正化に向けた公正取引委員会の取組」
            </a>
            (2026-11-11 確認)
          </p>
        </div>
        <a
          href="#contact"
          className={`inline-flex min-h-11 shrink-0 items-center justify-center bg-amber-600 px-6 text-sm font-bold text-white transition-[background-color] duration-150 hover:bg-amber-700 ${focusRing}`}
        >
          体制について相談する
        </a>
      </div>

      {showControls && (
        <div className="mt-6 border-t border-dashed border-gray-300 pt-3 text-[12px] leading-[1.8] text-gray-600">
          <p>
            <span className="font-bold text-gray-800">{current.label}</span>:{current.use}
          </p>
          <code className="mt-1 block font-mono text-[11px] text-gray-700">{current.code}</code>
        </div>
      )}

      <style>{`
        @keyframes blk44-swap {
          from { background-color: rgb(229 231 235); }
          to { background-color: rgb(229 231 235 / 0); }
        }
        .blk44-swap { animation: blk44-swap 180ms ease-out; }
        @media (prefers-reduced-motion: reduce) {
          .blk44-swap { animation: none !important; }
        }
      `}</style>
    </section>
  );
}

/** 1つのセル: 要点と補足。要点の大きさ・濃さは当社も相手も同じ */
function ClaimText({
  who,
  claim,
  showName,
  tone,
}: {
  who: string;
  claim: Claim;
  showName: boolean;
  tone?: "ours";
}) {
  return (
    <>
      <span className="sr-only">{who}:</span>
      {showName && (
        <span
          aria-hidden="true"
          className={`mb-1 block text-[11px] font-bold @2xl:hidden ${tone === "ours" ? "text-amber-800" : "text-gray-600"}`}
        >
          {who}
        </span>
      )}
      <strong className="block text-[15px] leading-[1.5] font-bold text-gray-900 [word-break:auto-phrase]">{claim.point}</strong>
      <span className="mt-1 block text-[13px] leading-[1.8] text-gray-700">{claim.detail}</span>
    </>
  );
}

/** 先頭列を固定して横にスワイプさせる版(<table> のまま) */
function ScrollTable({ rivals, points }: { rivals: Rival[]; points: Point[] }) {
  const captionId = useId();
  return (
    <div className="mt-4 @2xl:mt-7">
      <p className="mb-2 text-[11px] text-gray-500 @2xl:hidden" aria-hidden="true">
        横にスワイプすると3者を見られます(観点の列は固定)
      </p>
      <div
        role="region"
        aria-labelledby={captionId}
        tabIndex={0}
        className={`overflow-x-auto overscroll-x-contain border-y border-gray-900 ${focusRing}`}
      >
        <table className="w-full min-w-[640px] border-collapse text-left">
          <caption id={captionId} className="sr-only">
            当社と{rivals.map((item) => item.label).join("・")}の比較
          </caption>
          <thead>
            <tr>
              <th scope="col" className="sticky left-0 z-10 w-[120px] bg-white px-3 py-2 text-[11px] font-normal text-gray-500 shadow-[1px_0_0_rgb(229_231_235)]">
                比較の観点
              </th>
              <th scope="col" className="border-t-2 border-amber-600 bg-amber-50 px-3 py-2 text-[13px] font-bold text-amber-800">
                当社
              </th>
              {rivals.map((item) => (
                <th key={item.id} scope="col" className="border-t-2 border-gray-300 px-3 py-2 text-[13px] font-bold text-gray-800">
                  {item.label}
                </th>
              ))}
            </tr>
          </thead>
          <tbody>
            {points.map((point) => (
              <tr key={point.id} className="border-t border-gray-200 align-top">
                <th scope="row" className="sticky left-0 z-10 w-[120px] bg-white px-3 py-3 text-[13px] leading-[1.6] font-bold text-gray-900 shadow-[1px_0_0_rgb(229_231_235)]">
                  {point.axis}
                  <span className="block text-[11px] font-normal text-gray-500">{point.sub}</span>
                </th>
                <td className="bg-amber-50 px-3 py-3">
                  <ClaimText who="当社" claim={point.ours} showName={false} />
                </td>
                {rivals.map((item) => (
                  <td key={item.id} className="px-3 py-3">
                    <ClaimText who={item.label} claim={point.rivals[item.id]} showName={false} />
                  </td>
                ))}
              </tr>
            ))}
          </tbody>
        </table>
      </div>
    </div>
  );
}

export default CompareUsVsOthers;

Add to your project via shadcn CLI

npx shadcn@latest add https://designs.first-ch.com/r/compare-us-vs-others.json