Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Confirmation

An agent asks before a risky step, then shows what was decided.

Delete 3 stale views?

Removes the views from the workspace. This can't be undone.

Installation

pnpm add @heyramzi/ui

Usage

import {
  Confirmation,
  ConfirmationTitle,
  ConfirmationState,
  ConfirmationActions,
  ConfirmationAction,
  type ConfirmationKind,
} from "@heyramzi/ui/ai/confirmation";
<Confirmation {kind}>
  <ConfirmationTitle>Delete 3 stale views?</ConfirmationTitle>
  <ConfirmationState when="requested">
    <ConfirmationActions>
      <ConfirmationAction variant="outline" onclick={() => (kind = "rejected")}>Cancel</ConfirmationAction>
      <ConfirmationAction onclick={() => (kind = "accepted")}>Delete</ConfirmationAction>
    </ConfirmationActions>
  </ConfirmationState>
  <ConfirmationState when="accepted">Deleted 3 views.</ConfirmationState>
  <ConfirmationState when="rejected">Kept the views.</ConfirmationState>
</Confirmation>

Keyboard and accessibility

Key Does
Tab Moves focus between the action buttons.
Space Enter Runs the focused action.
  • The box is a region named "Confirmation". It reports busy while the action runs.
  • It's a polite live region from the moment it shows, so the result is read out.
  • While the action runs the buttons report disabled and focus stays put. Once it resolves the buttons go away and focus moves to the box.
  • With reduced motion on, the state swap doesn't animate.

API reference

Confirmation.Confirmation

kind required "idle" | "requested" | "accepted" | "rejected" | "failed"
executing boolean
Default false
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLElement> from svelte/elements
Prop Type Default
kind required "idle" | "requested" | "accepted" | "rejected" | "failed"
executing boolean false
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLElement> from svelte/elements

Confirmation.Title

class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLParagraphElement> from svelte/elements
Prop Type Default
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLParagraphElement> from svelte/elements

Confirmation.State

when required Exclude<ConfirmationKind, "idle">
The state whose content this shows.
children Snippet
Prop Type Default
when required

The state whose content this shows.

Exclude<ConfirmationKind, "idle">
children Snippet

Confirmation.Actions

class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Confirmation.Action

busyLabel string
busyWhen "always" | "default" | "never"
Default "default"
variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed"
Default "default"
size "sm" | "default" | "lg"
Default "sm"
icon boolean
ref HTMLButtonElement | HTMLAnchorElement | null
class string
disabled boolean
children Snippet
...rest
Every prop of HTMLButtonAttributes from svelte/elements
...rest
Every prop of HTMLAnchorAttributes from svelte/elements
Prop Type Default
busyLabel string
busyWhen "always" | "default" | "never" "default"
variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed" "default"
size "sm" | "default" | "lg" "sm"
icon boolean
ref HTMLButtonElement | HTMLAnchorElement | null
class string
disabled boolean
children Snippet
...rest Every prop of HTMLButtonAttributes from svelte/elements
...rest Every prop of HTMLAnchorAttributes from svelte/elements