react-call v2

Examples

Real Callables you can interact with. Click into any example to see the live demo, the two-file source, and notes on when to use it.

Dialog

Confirm dialog

Ask the user to confirm a destructive action before it runs. Returns a boolean to the caller.

Dialog

Alert dialog

A one-button notice. The caller awaits acknowledgement; the response type is void — the act of closing is the value.

Dialog

Prompt for input

window.prompt(), but with your component. Resolves with the entered string, or null on cancel.

Dialog
Nested

Nested dialog

A Callable that opens itself. Each open instance can spawn the same Callable from inside its own JSX — the library tracks the stack and resolves each promise independently.

Dialog
Mutation flow

Save form with mutation flow

A dialog with an async submit. useMutationFlow tracks pending; on throw, the call stays open so the user can retry without losing their input.

Dialog
Root props

Account-aware dialog

A dialog that greets the signed-in user without the caller ever passing their name. The user lives on a Root prop and reaches every call through call.root — separate from the per-call props.

Dialog
Mutation flow

Confirm with optional async

One Callable, two callers. Omit mutationFn and submit().orEnd(true) closes instantly with a fallback response; pass one and the async handler decides when to close — the same Confirm serves both.

Notification
Upsert

Progress toast

A singleton toast that updates itself as work progresses. Uses upsert() so consecutive calls mutate the same instance.

Notification
Stacking

Auto-dismissing error

A transient banner that closes itself via setTimeout. Multiple calls stack — each error gets its own banner.

Notification
Update

Live status update

A pinned status pill. The caller pushes new props into the open call as work advances — same instance, updated from the outside via the promise reference.

Notification
UpdateStacking

Broadcast to every call

Several upload pills stacked at once. One Upload.update(props) with no promise merges into every open call, so a single connection change flips them all — while each keeps its own filename.

Picker

Item picker

Show a list and resolve with the chosen item. Caller-side cancellation returns null; selecting an item returns the object itself.

Picker

Color picker

A grid of swatches. The current value is forwarded as a prop so the picker can render it as selected; resolves with the chosen hex or null.

Menu

Context menu

A positioned menu opened on right-click. The caller forwards the cursor coordinates so the Callable renders at the click site.

Menu

Command palette (⌘K)

A searchable list of actions. Keyboard-driven: arrow keys to navigate, Enter to run, Esc to dismiss.

Drawer
Exit animation

Bottom sheet

Slides up from the bottom and back down on close — the mobile-native pattern for action menus and quick choices.

Drawer
Exit animation

Settings drawer

A panel that slides in from the edge and slides back out on close. Props carry the initial settings as plain data; the Callable owns its own form state and resolves with the saved values, or null if the user dismisses.

Overlay

Image lightbox

Click a thumbnail, open the full image as an overlay. The Callable closes on backdrop click or Escape.

Flow

Multi-step wizard

A signup flow with three steps and a back/forward navigation. State lives inside the Callable; the caller awaits a single structured response.

Flow

Permission consent

OAuth-style "do you allow X?" prompt. Resolves with allow or deny — a tagged response, not a boolean.

Flow
End from caller

Resolve from the caller

The promise from call() is the call's identity. A timeout in the caller settles that exact open call from the outside with Approval.end(promise, false) — delivering a response without any in-dialog click.

21 of 21 examples