Made in 10Docs
GuidesAPI
SDKs

@daxov/react

A drop-in Conversation component and a useCall() hook for live calls with your character in a React app.

@daxov/react puts a live call in a React 18+ app: <Conversation> is the whole thing (the face, the AI badge, mute, end, a joining state), and useCall() is the hook under it, for your own UI. Both use @daxov/client.

Coming soonNot on npm yet

The package is private until the product has its name; @daxov/react is a placeholder name. The code below shows how it will be used.

<Conversation>

Call.tsx
import { Conversation } from "@daxov/react";
import "@daxov/react/theme.css"; // optional: the default look

export function Call() {
  return (
    <Conversation
      name="Alex"
      getCallStart={() => fetch("/api/calls", { method: "POST" }).then((r) => r.json())}
    >
      <p className="conversation-note">Your microphone is used only while the call is on.</p>
    </Conversation>
  );
}

getCallStart asks your server for a call: your endpoint calls POST /v1/calls with your secret key and answers forBrowser(start). It's called after the microphone is open, from the Start button's click.

Props

Prop

Type

Labels

Every word is in labels. The defaults:

LabelDefault
startStart the call
againCall again
allowMicAllow the microphone when your browser asks.
joiningJoining…
mute, unmuteMute, Unmute
endEnd
endedThe call has ended.
aiBadgeAI
aiBadgeTitleYou're talking to an AI, not a person.
you, aiYou, AI (in the transcript)

The AI badge is always shown; only its words change.

Styling

Without theme.css, <Conversation> is plain, unstyled elements: a root with the class conversation and parts with conversation-… classes (conversation-stage, conversation-controls, conversation-button, conversation-ai-badge, conversation-transcript…). The root carries its state as data attributes:

AttributeValues
data-phaseidle, opening, connecting, live, ended, failed
data-faceoff, joining, waiting, live, failed, ended
data-speakingtrue while the AI speaks
data-mutedtrue while the microphone is muted

With theme.css, set its variables with a class of yours. Every rule in it sits in :where(), so your class wins without a fight:

styles.css
.my-call {
  --conversation-accent: #1d6ad3;
  --conversation-radius: 8px;
}

The variables: --conversation-bg, -fg, -muted-fg, -border, -stage-bg, -stage-fg, -accent, -on-accent, -danger, -on-danger, -badge-bg, -badge-fg, -radius, -aspect (4 / 3 by default) and -font. It follows the visitor's light or dark setting; data-theme="light" or "dark" on the component fixes it.

useCall()

One live call for a component. start makes a fresh call each time, the state follows it, and the call ends when the component goes away.

MyCall.tsx
import { useCall } from "@daxov/react";

export function MyCall() {
  const { state, start, end, toggleMute } = useCall();
  const live = state.phase === "live";
  return (
    <div>
      <button onClick={() => start(() => fetch("/api/calls", { method: "POST" }).then((r) => r.json()))}>
        Talk to Alex
      </button>
      {live && <button onClick={toggleMute}>{state.muted ? "Unmute" : "Mute"}</button>}
      {live && <button onClick={() => end()}>End</button>}
      {state.error && <p role="alert">{state.error.message}</p>}
    </div>
  );
}
ReturnsWhat it is
stateThe call's state (fields)
callThe Call itself, for its events (call.on("transcript", …)); null before the first start
start(source)Starts a fresh call. Call it straight from a click: it opens the microphone first, then asks for the CallStart. Problems land in state.error; the promise doesn't reject for them
end(reason?)Hangs up
setMuted(muted), toggleMute()Mutes or unmutes

useCall(options) takes the same options as new Call(). Pass its result to <Conversation call={…}> to keep the drop-in look but start the call from your own button.

On this page