BLK-120Blocks

端を引くと蝶結びだけほどける水引の区切り線|紅白5本で蝶結びと結び切りを比べる(React)

祝儀袋やのし紙を選ぶ前に、蝶結びと結び切りの違いを動きで確かめる区切り線。見出しの下に紅白5本の水引を2つ並べ(左が蝶結び、右が結び切り)、「端を引く」か←→キーで両方の端を同時に引くと、蝶結びは輪が縮んで1本の線に戻り、結び切りは結び目が締まるだけで0.6秒で元の形に戻る。「結び直す」で蝶結びを描き直す。下に「何度あってもよいお祝い=蝶結び/一度きりにしたいこと=結び切り」を1行ずつ添え、出典は辞典に拠る。5本の縞は1本の SVG path に太さの違う線を6層重ねて作り、交差は上を通る区間を後から描く順で表す。ほどける動きはコマンド数をそろえた3枚の path を補間し、最初の表示では getTotalLength と stroke-dashoffset で線が左右から伸びて結び目を描く。props は knot・width・colors・pullable で、見出しの下に置く区切り線としてそのまま使える。動きを減らす設定では結んだ形と引いた後の形を上下2段の静止図で見せる。画像・依存ライブラリなし。

プレビュー

端を引くと、ほどけるのはどっち?

出産のお祝い

蝶結び結んだ形

全快祝い

結び切り結んだ形

← → キーでも引けます

蝶結び
ほどいて結び直せるので、出産など何度あってもよいお祝いに
結び切り
ほどけないので、全快祝い・結婚など一度きりにしたいことに

出典: デジタル大辞泉「水引」・世界大百科事典「水引」(コトバンク)。結婚の水引は地域・店舗で異なる場合があります。

区切り線として使う(props・コード)

props は knot('chou' | 'musubikiri')・width(px)・colors(white・red・edge)・pullable(false で動かない飾り)。 見出しの文言と knot を差し替えて使います。

本数を増やすときは、縞の重ねを外側へ1組足します(7本なら幅28の地と幅30の縁を加え、今の縁の色を境の色に替える)。

<h2 className="text-center text-xl font-bold">出産のお祝い</h2>
<MizuhikiDivider knot="chou" width={320} />

{/* 動かない飾りの区切り線にする */}
<MizuhikiDivider knot="musubikiri" pullable={false}
  colors={{ white: "#FFFFFF", red: "#C8102E", edge: "#C9C2B4" }} />
.mz path{fill:none;stroke-linecap:butt;stroke-linejoin:round}
.mz .mz-edge{stroke-width:22;stroke:var(--mz-edge)}
.mz .mz-5{stroke-width:20;stroke:var(--mz-cord)}
.mz .mz-3s{stroke-width:13;stroke:var(--mz-sep)}
.mz .mz-3{stroke-width:11;stroke:var(--mz-cord)}
.mz .mz-1s{stroke-width:5;stroke:var(--mz-sep)}
.mz .mz-1{stroke-width:3;stroke:var(--mz-cord)}
X でシェア

説明の全文を読む

祝儀袋やのし紙を選ぶ前に、蝶結びと結び切りの違いを動きで確かめる区切り線。見出しの下に紅白5本の水引を2つ並べ(左が蝶結び、右が結び切り)、「端を引く」か←→キーで両方の端を同時に引くと、蝶結びは輪が縮んで1本の線に戻り、結び切りは結び目が締まるだけで0.6秒で元の形に戻る。「結び直す」で蝶結びを描き直す。下に「何度あってもよいお祝い=蝶結び/一度きりにしたいこと=結び切り」を1行ずつ添え、出典は辞典に拠る。5本の縞は1本の SVG path に太さの違う線を6層重ねて作り、交差は上を通る区間を後から描く順で表す。ほどける動きはコマンド数をそろえた3枚の path を補間し、最初の表示では getTotalLength と stroke-dashoffset で線が左右から伸びて結び目を描く。props は knot・width・colors・pullable で、見出しの下に置く区切り線としてそのまま使える。動きを減らす設定では結んだ形と引いた後の形を上下2段の静止図で見せる。画像・依存ライブラリなし。

追加日:
2026-11-19
依存:
なし
tags
#divider #decoration #mizuhiki #japanese #gift #svg #path-morph #stroke-dashoffset #reduced-motion #no-image
"use client";

import { useCallback, useEffect, useId, useRef, useState, type CSSProperties } from "react";

/**
 * 端を引くと蝶結びだけほどける水引の区切り線(紅白5本・蝶結びと結び切りを並べて比べる)BLK-120
 *
 * 差別化: section-divider-shapes は境目の形を選ぶ道具、torn-edge-divider は境目の質感。区切り線そのものに
 * 意味(何度あってもよい/一度きり)を持たせ、同じ1押しで左右の結果が分かれる動きで見せるのは本ブロックだけ。
 * 英字の小見出し・末尾の矢印リンク・角丸・スクロール出現は使わない。
 *
 * 汎用技法メモ:
 * 1. **縞の紐は1本の path を太い順に重ねて描く**。幅 5p+2 の縁 → 5p の地 → 3p+s の境 → 3p−s の地 → p+s の境 → p−s の地、
 *    の6層で p 間隔の5本になる。本数を増やすなら、(2k+1)p±s の組を外側へ足すだけ(7本なら 7p の組を1つ足す)。
 * 2. **交差は描く順で表す**。紐を区間に分け、上を通る区間を後から描くと、縁ごと下の区間を覆って「上を通る」に見える。
 * 3. **形の補間はコマンド数をそろえた数の配列**。区間ごとに「始点+三次ベジェ n 個」の数の並びを3枚(結んだ形・輪が縮んだ形・
 *    1本の線)用意し、requestAnimationFrame で線形補間して d に書く。React の再描画はしない。1本の線の形では輪の区間を
 *    長さ0の直線にし、結びの巻きは長さ0の点にする(butt の端は長さ0だと何も描かない)。
 * 4. **描き始めは getTotalLength と stroke-dashoffset**。区間ごとに長さを測り、dasharray=長さ・dashoffset=長さ→0。
 *    端の区間は外の端から中央へ向けて定義しておくと、線が左右から伸びて結び目へ向かう。
 * 5. prefers-reduced-motion では motion-reduce:hidden / motion-reduce:grid で、結んだ形と引いた後の形を上下2段の静止図にする。
 */

/* ------------------------------------------------------------------ 形のデータ */

export type Knot = "chou" | "musubikiri";
export type MizuhikiColors = { white: string; red: string; edge: string };
export const DEFAULT_COLORS: MizuhikiColors = { white: "#FFFFFF", red: "#C8102E", edge: "#C9C2B4" };

/** 区間の色: 左の紐(白)・右の紐(紅)・中央で切り替える(結びの巻き) */
type Side = "w" | "r" | "split";
/** 区間 = 始点 (x, y) と三次ベジェ (c1x, c1y, c2x, c2y, x, y) の並び。形ごとに数の個数をそろえる */
type Piece = { side: Side; frames: number[][] };

const VB_W = 220;
const VB_H = 120;
const LINE_Y = 70;

// 1本の線の形: 左端 → 中央 → 右端が y=70 の上に並ぶ
const flat = (x0: number, x1: number, n: number) => {
  const out = [x0, LINE_Y];
  for (let i = 1; i <= n; i++) {
    const a = x0 + ((x1 - x0) * (i - 2 / 3)) / n;
    const b = x0 + ((x1 - x0) * (i - 1 / 3)) / n;
    const c = x0 + ((x1 - x0) * i) / n;
    out.push(a, LINE_Y, b, LINE_Y, c, LINE_Y);
  }
  return out;
};
const dot = (x: number, y: number, n: number) => Array.from({ length: 2 + n * 6 }, (_, i) => (i % 2 === 0 ? x : y));

/** 蝶結び: [結んだ形, 輪が縮んだ形, 1本の線]。描く順 = 配列の順(後ろほど上) */
export const CHOU: Piece[] = [
  // 左の端(外から中央へ)
  { side: "w", frames: [[8, 84, 44, 84, 80, 74, 104, 70], [3, 80, 40, 80, 82, 72, 104, 70], flat(2, 104, 1)] },
  // 右の端
  { side: "r", frames: [[212, 84, 176, 84, 140, 74, 116, 70], [217, 80, 180, 80, 138, 72, 116, 70], flat(218, 116, 1)] },
  // 左の輪(中央から左上へ出て、回って中央へ戻る)
  {
    side: "w",
    frames: [
      [106, 64, 100, 42, 74, 16, 54, 22, 34, 28, 48, 60, 106, 70],
      [106, 66, 98, 60, 86, 56, 84, 62, 82, 68, 96, 72, 106, 70],
      flat(104, 110, 2),
    ],
  },
  // 右の輪
  {
    side: "r",
    frames: [
      [114, 64, 120, 42, 146, 16, 166, 22, 186, 28, 172, 60, 114, 70],
      [114, 66, 122, 60, 134, 56, 136, 62, 138, 68, 124, 72, 114, 70],
      flat(110, 116, 2),
    ],
  },
  // 結びの巻き(縦に1周。中央で白と紅に分かれる)
  { side: "split", frames: [[110, 54, 110, 62, 110, 78, 110, 86], [110, 62, 110, 66, 110, 74, 110, 78], dot(110, LINE_Y, 1)] },
];

/** 結び切り: [結んだ形, 締まった形]。端は上へはねて交差する(白の端の上を紅の端が通る) */
export const MUSUBIKIRI: Piece[] = [
  { side: "w", frames: [[8, 84, 44, 84, 80, 74, 102, 70], [3, 80, 40, 80, 84, 72, 104, 70]] },
  { side: "r", frames: [[212, 84, 176, 84, 140, 74, 118, 70], [217, 80, 180, 80, 136, 72, 116, 70]] },
  // 白の紐の端(結び目から右上へはねる)
  { side: "w", frames: [[104, 66, 114, 54, 128, 40, 142, 24], [106, 68, 114, 56, 126, 42, 138, 28]] },
  // 紅の紐の端(結び目から左上へはねる・白の端の上を通る)
  { side: "r", frames: [[116, 66, 106, 54, 92, 40, 78, 24], [114, 68, 106, 56, 94, 42, 82, 28]] },
  // 結び目の巻き(締まると短くなる)
  { side: "split", frames: [[110, 56, 110, 64, 110, 78, 110, 86], [110, 62, 110, 66, 110, 74, 110, 78]] },
];

const toD = (a: number[]) => {
  let d = `M${a[0].toFixed(2)} ${a[1].toFixed(2)}`;
  for (let i = 2; i < a.length; i += 6) d += `C${a.slice(i, i + 6).map((v) => v.toFixed(2)).join(" ")}`;
  return d;
};
const lerp = (a: number[], b: number[], t: number) => a.map((v, i) => v + (b[i] - v) * t);
/** 行き過ぎない ease-in-out(弾ませない) */
const ease = (t: number) => (t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2);

/** 時刻 t(0〜1)を、キーフレームを順にたどる形へ。蝶結びは 0→1→2、結び切りは 0→1→0 */
function shapeAt(piece: Piece, knot: Knot, t: number) {
  const f = piece.frames;
  if (knot === "chou") {
    return t < 0.5 ? lerp(f[0], f[1], ease(t / 0.5)) : lerp(f[1], f[2], ease((t - 0.5) / 0.5));
  }
  // 結び切り: 0.3 で締まり、残り 0.6秒ぶんで元へ戻る
  return t < 1 / 3 ? lerp(f[0], f[1], ease(t * 3)) : lerp(f[1], f[0], ease((t - 1 / 3) * 1.5));
}

/* ------------------------------------------------------------------ 縞の重ね方(CSS) */

/** 5本の縞の幅(p=4・s=1)。7本にするなら .mz-7a{stroke-width:30}.mz-7b{stroke-width:28} を先頭に足し、5p の組の色を境に替える */
export const MIZUHIKI_CSS = `.mz path{fill:none;stroke-linecap:butt;stroke-linejoin:round}
.mz .mz-edge{stroke-width:22;stroke:var(--mz-edge)}
.mz .mz-5{stroke-width:20;stroke:var(--mz-cord)}
.mz .mz-3s{stroke-width:13;stroke:var(--mz-sep)}
.mz .mz-3{stroke-width:11;stroke:var(--mz-cord)}
.mz .mz-1s{stroke-width:5;stroke:var(--mz-sep)}
.mz .mz-1{stroke-width:3;stroke:var(--mz-cord)}`;
const LAYERS = ["mz-edge", "mz-5", "mz-3s", "mz-3", "mz-1s", "mz-1"] as const;

/* ------------------------------------------------------------------ 部品 */

type DividerProps = {
  knot?: Knot;
  /** 表示の幅(px)。省略時は親の幅いっぱい */
  width?: number;
  colors?: Partial<MizuhikiColors>;
  /** false で動かない飾りの区切り線にする(描き始めの動きも付けない) */
  pullable?: boolean;
  /** 0 = 結んだ形。蝶結びの 1 = 1本の線(静止図用) */
  stage?: 0 | 1;
  /** 外から引く・結び直すを伝える番号。増えるたびに動く(pull: 引く/tie: 結び直す) */
  signal?: { kind: "pull" | "tie"; n: number };
  className?: string;
};

/** 水引の区切り線1本。knot と colors を差し替えて見出しの下に置く */
export function MizuhikiDivider({ knot = "chou", width, colors, pullable = true, stage = 0, signal, className = "" }: DividerProps) {
  const c = { ...DEFAULT_COLORS, ...colors };
  const uid = useId().replace(/:/g, "");
  const pieces = knot === "chou" ? CHOU : MUSUBIKIRI;
  const groupRefs = useRef<(SVGGElement | null)[]>([]);
  const raf = useRef(0);
  const restFrame = knot === "chou" && stage === 1 ? 2 : 0;

  const setShape = useCallback(
    (get: (p: Piece) => number[]) => {
      pieces.forEach((p, i) => {
        const d = toD(get(p));
        groupRefs.current[i]?.querySelectorAll("path").forEach((el) => el.setAttribute("d", d));
      });
    },
    [pieces],
  );

  const run = useCallback((ms: number, step: (t: number) => void) => {
    cancelAnimationFrame(raf.current);
    const t0 = performance.now();
    const tick = (now: number) => {
      const t = Math.min(1, (now - t0) / ms);
      step(t);
      if (t < 1) raf.current = requestAnimationFrame(tick);
    };
    raf.current = requestAnimationFrame(tick);
  }, []);

  /** 描き始め: 端の区間が外から中央へ伸び(0〜0.7)、続いて輪・端・巻きが描かれる(0.45〜1)。合わせて1.2秒 */
  const drawIn = useCallback(() => {
    setShape((p) => p.frames[0]);
    const paths = groupRefs.current.map((g) => Array.from(g?.querySelectorAll("path") ?? []));
    const lens = paths.map((ps) => (ps[0] ? ps[0].getTotalLength() : 0));
    const apply = (t: number) =>
      paths.forEach((ps, i) => {
        const [a, b] = i < 2 ? [0, 0.7] : [0.45, 1];
        const k = ease(Math.min(1, Math.max(0, (t - a) / (b - a))));
        ps.forEach((el) => {
          el.style.strokeDasharray = `${lens[i] + 1} ${lens[i] + 1}`;
          el.style.strokeDashoffset = `${(lens[i] + 1) * (1 - k)}`;
        });
      });
    apply(0);
    run(1200, (t) => {
      apply(t);
      if (t === 1) paths.flat().forEach((el) => ((el.style.strokeDasharray = ""), (el.style.strokeDashoffset = "")));
    });
  }, [run, setShape]);

  useEffect(() => {
    if (!pullable || stage !== 0 || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
    drawIn();
    return () => cancelAnimationFrame(raf.current);
  }, [drawIn, pullable, stage]);

  const lastSignal = useRef(signal?.n ?? 0);
  useEffect(() => {
    if (!signal || signal.n === lastSignal.current || !pullable) return;
    lastSignal.current = signal.n;
    if (signal.kind === "pull") run(900, (t) => setShape((p) => shapeAt(p, knot, t)));
    else if (knot === "chou") drawIn();
  }, [signal, knot, pullable, run, setShape, drawIn]);

  useEffect(() => () => cancelAnimationFrame(raf.current), []);

  const vars = (side: Side) => {
    if (side === "w") return { "--mz-edge": c.edge, "--mz-cord": c.white, "--mz-sep": c.edge };
    if (side === "r") return { "--mz-edge": c.red, "--mz-cord": c.red, "--mz-sep": c.white };
    return { "--mz-edge": `url(#${uid}-e)`, "--mz-cord": `url(#${uid}-c)`, "--mz-sep": `url(#${uid}-s)` };
  };
  const split = (id: string, left: string, right: string) => (
    <linearGradient id={`${uid}-${id}`} gradientUnits="userSpaceOnUse" x1="0" y1="0" x2={VB_W} y2="0">
      <stop offset="0.5" stopColor={left} />
      <stop offset="0.5" stopColor={right} />
    </linearGradient>
  );

  return (
    <svg
      viewBox={`0 0 ${VB_W} ${VB_H}`}
      width={width}
      className={`mz block h-auto ${width ? "" : "w-full"} ${className}`}
      aria-hidden="true"
      data-knot={knot}
    >
      <defs>
        {split("e", c.edge, c.red)}
        {split("c", c.white, c.red)}
        {split("s", c.edge, c.white)}
      </defs>
      {pieces.map((p, i) => {
        const d = toD(p.frames[restFrame] ?? p.frames[0]);
        return (
          <g
            key={i}
            ref={(el) => {
              groupRefs.current[i] = el;
            }}
            style={vars(p.side) as CSSProperties}
          >
            {LAYERS.map((cls) => (
              <path key={cls} className={cls} d={d} />
            ))}
          </g>
        );
      })}
    </svg>
  );
}

/* ------------------------------------------------------------------ 見本 */

const KNOTS = [
  {
    knot: "chou" as const,
    heading: "出産のお祝い",
    name: "蝶結び",
    after: "ほどけて1本の線に",
    note: "ほどいて結び直せるので、出産など何度あってもよいお祝いに",
  },
  {
    knot: "musubikiri" as const,
    heading: "全快祝い",
    name: "結び切り",
    after: "締まるだけで、ほどけない",
    note: "ほどけないので、全快祝い・結婚など一度きりにしたいことに",
  },
];

const USAGE_TSX = `<h2 className="text-center text-xl font-bold">出産のお祝い</h2>
<MizuhikiDivider knot="chou" width={320} />

{/* 動かない飾りの区切り線にする */}
<MizuhikiDivider knot="musubikiri" pullable={false}
  colors={{ white: "#FFFFFF", red: "#C8102E", edge: "#C9C2B4" }} />`;

function CopyButton({ text, label }: { text: string; label: string }) {
  const [done, setDone] = useState(false);
  return (
    <button
      type="button"
      onClick={() => {
        navigator.clipboard?.writeText(text).then(
          () => setDone(true),
          () => setDone(false),
        );
        setTimeout(() => setDone(false), 1600);
      }}
      className="min-h-11 border border-stone-300 bg-white px-3 text-[13px] font-bold text-stone-800 hover:border-[#b45309] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#d97706]"
    >
      {done ? "コピーしました" : label}
    </button>
  );
}

export default function MizuhikiDrawDivider() {
  const [pulled, setPulled] = useState(false);
  const [signal, setSignal] = useState<{ kind: "pull" | "tie"; n: number }>({ kind: "tie", n: 0 });
  const rootRef = useRef<HTMLElement>(null);
  const busyUntil = useRef(0);

  const act = useCallback(() => {
    const now = performance.now();
    if (now < busyUntil.current) return;
    setPulled((was) => {
      const kind = was ? "tie" : "pull";
      busyUntil.current = now + (kind === "pull" ? 950 : 1250);
      setSignal((s) => ({ kind, n: s.n + 1 }));
      return !was;
    });
  }, []);

  // ←→キーでも同じ操作。入力欄・タブにいるときと、一覧の縮小カードでは反応しない
  useEffect(() => {
    const onKey = (e: KeyboardEvent) => {
      if ((e.key !== "ArrowLeft" && e.key !== "ArrowRight") || e.altKey || e.ctrlKey || e.metaKey || e.repeat) return;
      const t = e.target as HTMLElement | null;
      if (t && (t.closest("input, textarea, select, [contenteditable='true'], [role='tab'], [role='tablist']") || t.isContentEditable)) return;
      const el = rootRef.current;
      if (!el || el.offsetWidth === 0 || el.getBoundingClientRect().width / el.offsetWidth < 0.75) return;
      if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
      e.preventDefault();
      act();
    };
    window.addEventListener("keydown", onKey);
    return () => window.removeEventListener("keydown", onKey);
  }, [act]);

  return (
    <section ref={rootRef} className="mx-auto w-full max-w-3xl border-y border-[#d97706] bg-white px-4 py-6 text-[#2B2B2B] sm:px-8 sm:py-10">
      <style>{MIZUHIKI_CSS}</style>

      <h2 className="text-center text-[clamp(1.25rem,5vw,1.75rem)] font-bold leading-snug">端を引くと、ほどけるのはどっち?</h2>

      {/* 動く見本(動きを減らす設定では隠す) */}
      <div className="motion-reduce:hidden">
        <div className="mt-6 grid grid-cols-2 gap-x-3 sm:gap-x-8">
          {KNOTS.map((k) => (
            <figure key={k.knot} className="min-w-0 text-center">
              <p className="text-[15px] font-bold sm:text-lg">{k.heading}</p>
              <MizuhikiDivider knot={k.knot} signal={signal} className="mt-2" />
              <figcaption className="mt-1 text-[14px] font-bold">
                {k.name}
                <span className="mt-0.5 block min-h-[1.5em] text-[12px] font-normal text-stone-600" data-state={k.knot}>
                  {pulled ? k.after : "結んだ形"}
                </span>
              </figcaption>
            </figure>
          ))}
        </div>

        <div className="mt-4 border-t border-stone-200 pt-4">
          <button
            type="button"
            onClick={act}
            data-pull
            aria-keyshortcuts="ArrowLeft ArrowRight"
            className="block min-h-12 w-full bg-[#b45309] px-4 text-[17px] font-bold tracking-wide text-white transition-colors hover:bg-[#92400e] active:bg-[#78350f] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#d97706]"
          >
            {pulled ? "結び直す" : "端を引く"}
          </button>
          <p className="mt-1.5 text-center text-[12px] text-stone-500">← → キーでも引けます</p>
          <p className="sr-only" aria-live="polite">
            {pulled ? "蝶結びはほどけて1本の線になりました。結び切りは締まって、結んだ形のままです。" : ""}
          </p>
        </div>
      </div>

      {/* 動きを減らす設定の静止図: 上段=結んだ形、下段=引いた後 */}
      <div className="mt-6 hidden motion-reduce:block">
        {(["結んだ形", "引いた後"] as const).map((row, r) => (
          <div key={row} className={r ? "mt-4 border-t border-stone-200 pt-4" : ""}>
            <p className="text-[13px] font-bold text-stone-600">{row}</p>
            <div className="mt-1 grid grid-cols-2 gap-x-3 sm:gap-x-8">
              {KNOTS.map((k) => (
                <figure key={k.knot} className="min-w-0 text-center">
                  {r === 0 && <p className="text-[15px] font-bold sm:text-lg">{k.heading}</p>}
                  <MizuhikiDivider knot={k.knot} pullable={false} stage={r === 1 && k.knot === "chou" ? 1 : 0} className="mt-1" />
                  <figcaption className="mt-1 text-[14px] font-bold">
                    {k.name}
                    {r === 1 && <span className="block text-[12px] font-normal text-stone-600">{k.after}</span>}
                  </figcaption>
                </figure>
              ))}
            </div>
          </div>
        ))}
      </div>

      <dl className="mt-5 space-y-2 border-t border-stone-200 pt-4 text-[14px] leading-relaxed">
        {KNOTS.map((k) => (
          <div key={k.knot} className="grid grid-cols-[4.5em_1fr] gap-x-2">
            <dt className="font-bold">{k.name}</dt>
            <dd>{k.note}</dd>
          </div>
        ))}
      </dl>

      <p className="mt-4 border-t border-stone-200 pt-3 text-[12px] leading-relaxed text-stone-600">
        出典:{" "}
        <a className="underline underline-offset-2 hover:text-[#b45309] focus-visible:outline-2 focus-visible:outline-[#d97706]" href="https://kotobank.jp/word/%E6%B0%B4%E5%BC%95" target="_blank" rel="noopener noreferrer">
          デジタル大辞泉「水引」・世界大百科事典「水引」(コトバンク)
        </a>
        。結婚の水引は地域・店舗で異なる場合があります。
      </p>

      <details className="group mt-4 border-t border-stone-200 pt-1 text-[13px]">
        <summary className="flex min-h-11 cursor-pointer list-none items-center justify-between font-bold text-stone-700 focus-visible:outline-2 focus-visible:outline-[#d97706] [&::-webkit-details-marker]:hidden">
          区切り線として使う(props・コード)
          <span aria-hidden="true" className="text-stone-400 group-open:rotate-45 motion-reduce:transition-none">+</span>
        </summary>
        <div className="space-y-3 pb-2 leading-relaxed text-stone-700">
          <p>
            props は knot(&apos;chou&apos; | &apos;musubikiri&apos;)・width(px)・colors(white・red・edge)・pullable(false で動かない飾り)。
            見出しの文言と knot を差し替えて使います。
          </p>
          <p>本数を増やすときは、縞の重ねを外側へ1組足します(7本なら幅28の地と幅30の縁を加え、今の縁の色を境の色に替える)。</p>
          <pre className="overflow-x-auto border border-stone-200 bg-stone-50 p-3 text-[12px] leading-snug"><code>{USAGE_TSX}</code></pre>
          <pre className="overflow-x-auto border border-stone-200 bg-stone-50 p-3 text-[12px] leading-snug"><code>{MIZUHIKI_CSS}</code></pre>
          <div className="flex flex-wrap gap-2">
            <CopyButton text={USAGE_TSX} label="TSXをコピー" />
            <CopyButton text={MIZUHIKI_CSS} label="CSSをコピー" />
          </div>
        </div>
      </details>
    </section>
  );
}

shadcn CLI でプロジェクトに追加

npx shadcn@latest add https://designs.first-ch.com/r/mizuhiki-draw-divider.json