Pipecat UI
Components

Connect Button

One button for the whole session lifecycle, driven by the Pipecat transport state.

Open in Storybook

disconnected

Installation

pnpm dlx shadcn@latest add @pipecat/connect-button

Usage

import { ConnectButton } from "@/components/pipecat/connect-button";

// Bare: falls back to client.connect() / client.disconnect() —
// enough when the transport is configured with its connection params.
<ConnectButton />

// App-owned session start
<ConnectButton
  onConnect={() => client.startBotAndConnect({ endpoint: "/api/start" })}
/>

Every transport state has a default label, style, and action. Override only the states you care about with stateProps — each entry accepts children, icon, variant, className, disabled, and onClick:

<ConnectButton
  stateProps={{
    ready: { children: "End call", icon: <PhoneOffIcon /> },
    error: { children: "Try again", onClick: () => reconnectWithBackoff() },
  }}
/>

Resolution is derivative: per-state override → top-level prop → built-in default. Setting a variant (top-level or per-state) replaces the default token styling for that state, since the styling is designed around the default variant.

Key props

PropTypeDescription
statePropsConnectButtonStateMapSparse per-TransportState overrides: children, icon, variant, className, disabled, onClick
onConnect / onDisconnect() => voidReplace the default client.connect() / client.disconnect() actions
childrenReactNodeLabel for every state (individual states can still override)
variant / sizeButton propsPassed to the underlying shadcn Button; variant applies to all states. Icon sizes (icon, icon-sm, …) render icon-only with per-state default glyphs

States

data-stateDefault
disconnected, initializedConnect in the active token fill; click connects
initializingInitializing… with spinner, disabled
authenticating, authenticated, connectingConnecting… with spinner, disabled
connected, readyDisconnect in the inactive token tint; click disconnects
disconnectingDisconnecting… with spinner, disabled
errorRetry as destructive; click connects again

The raw transport state is always exposed as data-state, so states can also be styled from CSS (data-[state=ready]:…). Use ConnectButtonView with a transportState prop when managing state yourself.

On this page