Characters

Bot

A chat assistant with a face: it listens, thinks and answers by changing shape.

Preview

Installation

Terminal
npx @usefluid/cli add bot

Usage

Bot.tsx
import { Bot, type BotState, type Message } from "./Bot";

<Bot state={state} messages={messages} name="Acme help">
  <form onSubmit={send}>
    <label htmlFor="ask">Ask a question</label>
    <input id="ask" value={draft} onChange={(e) => { setDraft(e.target.value); setState("listening"); }} />
    <button>Send</button>
  </form>
</Bot>

Colours

WhatHow
The facecolor prop: <Bot color="#ff5a1f" />. Without it, --fluid-accent.
Your messages--fluid-accent for the bubble and --fluid-on-accent for its text.
The bot's messages--fluid-surface, --fluid-border and --fluid-text.
Status line--fluid-text-2.

Set the variables on any parent to change one bot without touching the others:

Bot
<div style={{ "--fluid-accent": "#7c3aed", "--fluid-on-accent": "#ffffff" } as React.CSSProperties}>
  <Bot state={state} messages={messages} />
</div>

The eyes are holes cut out of the face, so they show the background behind it.

API reference

PropTypeDefaultDescription
state"idle" | "listening" | "thinking" | "talking" | "done"—listening while the person types, thinking while waiting, talking when the answer arrives, then done or idle.
messages{ id, from: "person" | "bot", text }[]—The conversation.
namestring"Assistant"Shown and announced.
youstring"You"How the person's messages are announced.
statusPartial<Record<state, string>>Ready, Listening...Your own status words.
stillbooleanfalseNo breathing or blinking.
colorstring--fluid-accentColour of the face.
childrenReactNode—Your input area, below the messages.

Keyboard and screen readers

The conversation is a log: new messages are announced with who said them. The status line is announced too.

Notes

The bot has no input of its own; pass yours as children.

Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

The bot's face is the Pet. Each state of the conversation becomes a mood and a direction for the eyes: listening, it looks at your message; thinking, it looks up; answering, it looks at the reply. Messages arrive out of a blur, and the state goes to screen readers.

For your agent

For your agent

Add Bot to my project with the Fluid library. Use Bot in my product's support chat, wired to the real messages. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.