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

    Ask a component.

    Await the answer.

    A tiny, headless React utility for imperative dialogs and toasts.

    Features

    Three ideas — and what they look like in your app.

    Promise-based

    await toi(Component) mounts your component and resolves with whatever it passes to resolve — an imperative call site instead of a pile of dispatched state.

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

    Headless

    toi only mounts your component and watches when it's done. No bundled styles to fight, no design system to adopt — markup, style, and motion stay entirely yours.

    Animation aware

    Calling resolve doesn't unmount right away — toi waits for exit animations to finish first, so dialogs and toasts can animate out cleanly instead of vanishing mid-transition.

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