function / @typed/ui/Dialog

RequestClose

Renders a button that starts the cancelable native close-request lifecycle.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Cancelable dismissal
Since
1.0.0

Import

import { RequestClose } from "@typed/ui/Dialog";

Signatures

export declare function RequestClose<const Options extends CloseOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, CloseInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;

Why

Consumers can intercept a real cancel event before the dialog closes. controls selects native command="request-close" and disables the Fx click fallback; omit it when native dialog commands are unavailable.

Ownership and lifetime

Running the Fx owns handlers by Scope; dialog registration remains owned by the corresponding Content Scope.

Examples

import { Effect } from "effect"
import * as Dialog from "@typed/ui/Dialog"

const program = Effect.gen(function* () {
  const state = yield* Dialog.makeState({ open: true })
  return Dialog.RequestClose({ state, content: "Cancel" })
})

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source