<!-- AvatarFactory Docs · https://avatarfactory.in/docs/sdk/react/styling · Full map: https://avatarfactory.in/llms.txt -->

# Styling

The SDK fits any UI. One required stylesheet, then full control — className, style, and CSS selectors.

## Required stylesheet

**Import this once in your app entry point.** Without it, the avatar container, connectivity dot, and control buttons don't render correctly.

```tsx
// app/layout.tsx
import "@avatarfactory/react/styles.css";
```

## Sizing the avatar

The canvas fills 100% of its parent container. **Always give the parent explicit dimensions.**

```tsx
{/* Fixed size */}
<div style={{ width: 400, height: 400 }}>
  <Avatar />
</div>

{/* Responsive — fills container width, preserves square ratio */}
<div className="w-full aspect-square max-w-md mx-auto">
  <Avatar />
</div>
```

> Without a sized parent, the canvas renders at zero dimensions and appears invisible. This is the most common setup mistake.

## className and style props

Pass `className` or `style` directly to the `` component to style its container div.

```tsx
{/* With Tailwind — inside a sized parent */}
<div className="w-96 h-96">
  <Avatar className="rounded-2xl overflow-hidden shadow-xl shadow-black/50" />
</div>

{/* With inline styles — inside a sized parent */}
<div style={{ width: 384, height: 384 }}>
  <Avatar style={{ borderRadius: 16, boxShadow: "0 0 40px rgba(139, 92, 246, 0.3)" }} />
</div>
```

## Styling the overlays

Captions, the status banner, and the thinking indicator each take a `className`
and a `style` prop on ``, so you can restyle them without reaching into
the SDK's own CSS.

```tsx
<Avatar
  captionClassName="font-medium tracking-tight"
  captionStyle={{ fontSize: 18, maxWidth: "80%" }}

  statusBannerClassName="rounded-full"
  statusBannerStyle={{ backdropFilter: "blur(8px)" }}

  thinkingIndicatorClassName="opacity-80"
/>
```

> Whether an overlay exists is a **provider** decision (`transcript`,
>   `statusBanner`, `thinkingIndicator` in the config); how it looks is an
>   **Avatar** prop. Styling an overlay you never enabled does nothing.

> Overlays sit on top of an animated character, so test their contrast against
>   the busiest frame, not a still one. Captions in particular are an
>   accessibility feature — 4.5:1 against whatever moves behind them.

## Styling the connectivity dot

The dot is a DOM element with CSS classes you can target:

```css
.connectivity-dot.connected    { background-color: #22c55e; } /* green */
.connectivity-dot.disconnected { background-color: #ef4444; } /* red   */
```

> Colour alone is not an accessible status signal. If connection state matters
>   to your users, pair the dot with text or an icon rather than relying on
>   green-versus-red — roughly 1 in 12 men cannot reliably tell them apart.

## Built-in controls

Show or hide the floating start/stop buttons via the provider config:

```tsx
const config = {
  // ...
  controls: { enabled: false }, // hide built-in buttons; use your own UI
};
```

> `controls` is configured on `` — not as a prop on ``.

## Design patterns

### Circular avatar

```tsx
<div className="relative w-64 h-64">
  <Avatar className="rounded-full overflow-hidden shadow-2xl shadow-purple-500/20" />
</div>
```

### Responsive hero

```tsx
<div className="relative w-full h-[600px]">
  <Avatar className="w-full h-full object-cover" />
  <div className="absolute bottom-8 left-8">
    <h1 className="text-4xl font-bold text-white">Meet Luna</h1>
    <p className="text-white/70 mt-1">Your AI travel assistant</p>
  </div>
</div>
```

### Framed with status ring

```tsx
<div className="relative w-80 h-80">
  <div className="absolute inset-0 rounded-2xl ring-1 ring-purple-500/30 shadow-lg shadow-purple-500/10" />
  <Avatar className="rounded-2xl" />
</div>
```
