Click-to-Call Widget
Click-to-Call Widget
<sw-click-to-call> is a single-button call element. With a
token and a destination, it renders a styled button that dials
the configured destination and opens the full call UI in a modal.
Under the hood it’s a thin wrapper around <sw-call-widget>
configured in modal mode — the button is the trigger; media,
controls, and the optional AI transcript are delegated to the widget
once the user clicks.
Minimum embed
One script tag, one element:
For bundler-based projects, swap the script tag for
import "@signalwire/web-components/sw-click-to-call". The element
markup is identical. See Overview
for the two pathways.
Token
token accepts two formats:
- Embed token (
c2c_…/c2t_…prefix) — created from a Click to Call resource in the dashboard (sidebar → Tools → Click to Call). The destination is pinned in the resource configuration; thedestinationattribute is ignored when the embed token already pins one. The widget routes throughembeds.signalwire.comautomatically. - Subscriber Access Token (SAT) — a JWT minted by your backend
for an authenticated user. Pair it with an explicit
destination.
For public pages, prefer the embed token: it’s safe to expose in HTML, scoped to a single destination, and revocable from the dashboard. Use a SAT when the visitor is signed into your app and the call should be attributed to their account. See Authentication.
Attributes
token is required. destination selects the resource to dial
(ignored when the embed token already pins one). label sets the
button text. audio-only skips video. See
<sw-click-to-call> for the full attribute list.
Events
The element bubbles three composed events:
sw-dial— dialing startedsw-call-hangup— the visitor clicked hangupsw-call-ended— the call reached any terminal state
Styling
The button reads from the SignalWire DTCG tokens shipped in
theme.css. Override them at any ancestor to restyle without
piercing shadow DOM:
For finer control, target the inner button via its
CSS Part:
See Theming for the full token list and brand-color recipes.
When to use <sw-call-widget> instead
<sw-click-to-call> is single-destination, button-only, modal-only.
Use <sw-call-widget> directly for any of:
- Multiple destinations or dynamic routing.
- Inline (non-modal) rendering.
- A custom trigger element (use the default slot of
<sw-call-widget>). - Receiving incoming calls (
allow-incoming-calls). - Programmatic
dial()/hangup()control.
Both share the same underlying call lifecycle — see
<sw-call-widget> for the full surface.