Skip to content

Conversation

A person asking and Sypnia answering: what the person wrote sits in a box at the end of the line; Sypnia answers in the voice, opened by the lit dot.

import { Conversation } from '@sypnia/ui/react'

On this page
  1. A few turns
  2. Small, inside a mock
  3. When to use it
  4. For everyone
  5. Props

A few turns

The second answer tells of a failure: tone fail.

  1. You: How did we do this week?

  2. Sypnia: You got 142 orders, 18 more than last week. The sourdough loaf sold best.

  3. You: Why did two people not pay yesterday?

  4. Sypnia: Their cards were declined at the step “charge”. The fix is ready for you to review.

Code
import { Conversation, useSypnia } from '@sypnia/ui/react';

const en = {
  label: 'La Espiga asks its project',
  items: [
    { from: 'person', text: 'How did we do this week?' },
    { from: 'sypnia', text: 'You got 142 orders, 18 more than last week. The sourdough loaf sold best.' },
    { from: 'person', text: 'Why did two people not pay yesterday?' },
    { from: 'sypnia', text: 'Their cards were declined at the step “charge”. The fix is ready for you to review.', tone: 'fail' },
  ],
} as const;
const es: typeof en = {
  label: 'La Espiga le pregunta a su proyecto',
  items: [
    { from: 'person', text: '¿Cómo nos fue esta semana?' },
    { from: 'sypnia', text: 'Recibiste 142 pedidos, 18 más que la semana pasada. Lo que más se vendió fue el pan de masa madre.' },
    { from: 'person', text: '¿Por qué dos personas no pudieron pagar ayer?' },
    { from: 'sypnia', text: 'Les rechazaron la tarjeta en el paso «cobrar». El cambio está listo para que lo revises.', tone: 'fail' },
  ],
} as unknown as typeof en;

export default function Chat() {
  const c = useSypnia().locale === 'es' ? es : en;
  return <Conversation label={c.label} items={[...c.items]} />;
}

Small, inside a mock

  1. You: Buy laespiga.co and connect it.

  2. Sypnia: Done: bought with your credits and connected.

Code
import { Conversation, useSypnia } from '@sypnia/ui/react';

export default function Small() {
  const es = useSypnia().locale === 'es';
  return (
    <div style={{ maxWidth: '24rem' }}>
      <Conversation size="sm" items={es
        ? [{ from: 'person', text: 'Compra laespiga.co y conéctalo.' }, { from: 'sypnia', text: 'Listo: comprado con tus créditos y conectado.' }]
        : [{ from: 'person', text: 'Buy laespiga.co and connect it.' }, { from: 'sypnia', text: 'Done: bought with your credits and connected.' }]} />
    </div>
  );
}

When to use it

Use it when

  • Showing a product at work on a landing: what someone asks, what the agent does.
  • The story of a task told as a few turns.

Do not use it when

  • A real chat with sending, typing and history: that is an app screen.
  • More than five or six turns: show the moment that matters.

For everyone

  • It is an ordered list; each message starts with who spoke («You:», «Sypnia:»), hidden from sight.
  • An answer about something that broke has an ember dot and says so in its words, never by colour alone.

Props

ConversationTypeDefault
itemsrequired ConversationMessage[]
label string
names { person?: string; sypnia?: string; } | undefined {}
size "sm" | "md" md
  1. A few turns
  2. Small, inside a mock
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms