For AI agents: the complete documentation index is available at /toi/ja/llms.txt, the full documentation bundle is available at /toi/ja/llms-full.txt, and this page is available as Markdown at /toi/ja/index.md.
  • 日本語
  • toi

    問いかけて、

    答えを待つ。

    命令的なダイアログ・トーストのための、小さなヘッドレス React ユーティリティ。

    機能

    3 つの考え方と、実際のアプリでの見え方。

    Promise ベース

    await toi(Component) はコンポーネントをマウントし、resolve に渡した値でそのまま解決します。state を組み立てる代わりに、命令的な一行として書けます。

    const ok = await toi(Confirm);
    // ok === true once resolve(true) runs

    ヘッドレス

    toi が担うのはマウントと完了の監視だけ。上書きすべき既定のスタイルも、従うべきデザインシステムもありません。マークアップ・スタイル・モーションは、すべてあなたのものです。

    アニメーションを意識した設計

    resolve を呼んでもすぐには消えません。終了アニメーションの完了を待ってから取り除くので、ダイアログやトーストは途中で消えることなく、きれいにアニメーションできます。

    resolve();
    // waits for the exit animation, then unmounts