For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReferenceClick-to-Call
GuidesReferenceClick-to-Call
  • Core
    • Overview
  • Entities
    • SignalWire
    • Address
    • Participant
    • ClientPreferences
    • SelfCapabilities
    • SelfParticipant
    • User
    • WebRTCCall
  • Web Components
    • Overview
    • sw-audio-level
    • sw-call-controls
    • sw-call-dialpad
    • sw-call-media
    • sw-call-provider
    • sw-call-status
    • sw-call-widget
    • sw-click-to-call
    • sw-device-selector
    • sw-directory
    • sw-local-camera
    • sw-participant-controls
    • sw-participants
    • sw-self-media
    • sw-ui-alert
    • sw-ui-background
    • sw-ui-call-layout
    • sw-ui-content-drawer
    • sw-ui-control-bar
    • sw-ui-dialpad
    • sw-ui-dropup
    • sw-ui-icon
    • sw-ui-modal
    • sw-ui-responsive-container
    • sw-ui-split-button
    • sw-ui-transcript-view
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • class: SwUiAlert, sw-ui-alert
  • Fields
  • title
  • description
  • type
  • Methods
  • Attributes
  • CSS Properties
  • Slots
  • Functions
  • Events
Web Components

sw-ui-alert

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

sw-ui-background

Next
Built with

Modal confirmation / alert dialog primitive built on the native <dialog> element. Resolves a Promise with the user’s choice when used via the companion showPrompt() helper.

1<sw-ui-alert id="confirm" title="Hang up?" confirm-label="Hang up" cancel-label="Stay"></sw-ui-alert>

Two interaction modes are selectable through the reflected type attribute:

  • confirm (default) — renders both Cancel and OK buttons; the returned Promise resolves to true on accept and false on reject / dialog close.
  • alert — renders only OK; the Promise resolves to true once acknowledged or the dialog is dismissed.

The dialog uses the platform <dialog> element so focus management, ESC-to-dismiss, and ::backdrop styling all come for free.

Class: SwUiAlert · Module: packages/web-components/src/components/UI/sw-ui-alert.ts

class: SwUiAlert, sw-ui-alert

Fields

title
string

title field.

description
stringDefaults to ''

description field.

type
PromptTypeDefaults to 'confirm'

type field.

Methods

NamePrivacyDescriptionParametersReturnInherited From
showOpens the prompt and returns a promise that resolves with the user’s choice.Promise<boolean>

Attributes

NameFieldInherited From
titletitle
descriptiondescription
typetype

CSS Properties

NameDefaultDescription
--type-family-bodyDialog font family.
--radius-mdDialog border radius.
--shadow-mdDialog drop shadow.
--interactive-button-primary-bgBackground color of the accept button.
--interactive-button-primary-hoverHover background of the accept button.

Slots

NameDescription
Default slot for rich body content. When non-empty, takes priority over the `description` property.

Functions

NameDescriptionParametersReturn
showPromptProgrammatically show a prompt and await the user’s response.options: { title: string; description?: string; type?: PromptType; }Promise<boolean>

Events

NameDetailDescription
sw-ui-alert-accept—User clicked OK / accepted. No detail.
sw-ui-alert-reject—User clicked Cancel, closed via ESC, or