suiss/ui · AI
Message
One turn of a conversation: the person's message, and the agent's reply with actions to copy, rate and retry it.
Use this pattern for one turn in a thread. The person's text is a Bubble on a Message with align="end". The agent's reply is plain content on a Message, with actions under it. A thread of these turns is a Chat.
Installation
The pattern is built with Message, Bubble, Button and Tooltip.
Or use the suiss/ui CLI:
Usage
Put actions in MessageFooter. It follows the message alignment, so on the person's turn the actions sit at the end. Use ghost icon buttons with a tooltip for each:
- Copy writes the reply to the clipboard and swaps to a check for two seconds.
- Good response and Bad response are toggles. Set
aria-pressedso screen readers announce the state. - Retry runs the turn again.
- Edit on the person's turn puts the text back in the field.
Render markdown replies with your markdown renderer of choice, and route fenced code to a Code Block.
AI SDK
Branch on the message role. The person's turn is the bubble. The agent's turn is the reply, and regenerate with the message id runs it again.
API Reference
See Message, Bubble and Tooltip.
Accessibility
- Every action is an icon button, so give each an
aria-label; the tooltip repeats it for pointer users. - Change the label when the state changes, such as "Copy" to "Copied", so the change is announced.
- Feedback buttons are toggles and set
aria-pressed.
Message on mobile is built from the same parts as on the web: Message, Bubble, Code Block, Button. The example above is a static demo; connect it to your agent by rendering the same parts from your messages.
Installation
API Reference
See Message, Bubble, Code Block, Button.