> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# Web Components

`@signalwire/web-components` is a set of custom HTML elements built
on [Lit](https://lit.dev) that wraps the Browser SDK in declarative
markup. They work in vanilla HTML, React, Vue, Angular, or
server-rendered templates — no imperative JavaScript required for
the common cases.

The headline element is [`<sw-call-widget>`], which owns the full
call lifecycle (client init, dialing, media, controls, optional AI
transcript) and renders inline or as a modal. Around it sits a
family of composable primitives — `<sw-call-media>`,
`<sw-local-camera>`, `<sw-call-controls>`, `<sw-device-selector>`,
and the `sw-ui-*` presentational layer — that can be used à la
carte. See the
[Web Components reference](/docs/browser-sdk/v4/reference/web-component)
for the full element list.

## Two ways to load the library

A single self-contained `<script>` tag. Registers every custom
element and exposes the SDK on `window.SignalWireUI`. For static
sites, CMS pages, and contexts without a bundler.

`npm install @signalwire/web-components@latest`. Tree-shakes through
your bundler, supports per-element subpath imports, ships
TypeScript types. For SPAs and framework apps.

Both register the same custom elements with the same attribute and
event APIs. They differ only in how the script is loaded and where
SDK classes are imported from.

## Embed pathway

The embed bundle is a single IIFE file that registers every custom
element as a side effect and re-exports the SDK on
`window.SignalWireUI`. No build step.

```html
<!doctype html>
<html>
  <head>
    <script src="https://unpkg.com/@signalwire/web-components/dist/embed/signalwire-web-components-embed.iife.js"></script>
  </head>
  <body>
    <sw-call-widget
      token="c2c_892b29eca7b6d96091faf713f07cdf46"
      destination="/public/support"
      transcription
    >
      <sw-ui-background slot="background" default></sw-ui-background>
    </sw-call-widget>
  </body>
</html>
```

SDK classes are available on the global for programmatic use:

```html
<script>
  const { SignalWire, StaticCredentialProvider, EmbedTokenCredentialProvider } =
    SignalWireUI;

  // Embed token (c2c_ / c2t_ prefix) — uses embeds.signalwire.com:
  const client = new SignalWire(
    new EmbedTokenCredentialProvider("embeds.signalwire.com", "c2c_…")
  );

  // SAT token — points at your project:
  const client2 = new SignalWire(
    new StaticCredentialProvider({ token: "eyJ…your_SAT…" })
  );
</script>
```

Pick the embed pathway for marketing sites, landing pages, and CMS
templates — anywhere a single copy-pasteable URL is the goal.

## npm pathway

Install the components alongside `@signalwire/js` and `rxjs` (peer
dependencies):

```bash
npm install @signalwire/web-components@latest @signalwire/js@latest rxjs
```

Register every element with a side-effect import:

```js
import "@signalwire/web-components";
```

Or import only the elements in use:

```js
import "@signalwire/web-components/sw-call-widget";
import "@signalwire/web-components/sw-ui-background";
```

Use them anywhere in markup or JSX:

```html
<sw-call-widget
  token="c2c_892b29eca7b6d96091faf713f07cdf46"
  destination="/public/support"
  transcription
>
  <sw-ui-background slot="background" default></sw-ui-background>
</sw-call-widget>
```

SDK classes import from `@signalwire/js`:

```js
import { SignalWire, StaticCredentialProvider } from "@signalwire/js";
```

For framework-specific wrappers (React, Vue, Svelte), see
[Framework Integration](/docs/browser-sdk/v4/guides/framework-integration).

## Anatomy of a widget

[`<sw-call-widget>`] is the simplest entry point — set `token` and
`destination` and it handles the rest. Internally it composes the
same primitives that are available individually:

```html
<sw-call-provider .call="${callObject}" .deviceController="${deviceController}">
  <sw-call-media></sw-call-media>
  <sw-self-media></sw-self-media>
  <sw-call-controls></sw-call-controls>
</sw-call-provider>
```

`<sw-call-provider>` sets up reactive contexts (call state, devices,
transcript, user events) that descendants subscribe to
automatically. Reach for the primitives when the built-in layout
doesn't fit the design.

## Next

* [Click-to-Call Widget](/docs/browser-sdk/v4/guides/click-to-call-widget) — single call button.
* [Theming](/docs/browser-sdk/v4/guides/web-components-theming) — design tokens and CSS Parts.
* [Customization](/docs/browser-sdk/v4/guides/web-components-customization) — slots, events, primitives.
* [Web Components reference](/docs/browser-sdk/v4/reference/web-component) — per-element attributes, events, and slots.

[`<sw-call-widget>`]: /docs/browser-sdk/v4/reference/web-component/sw-call-widget