docs/components/chat-ai/MessageBubble

MessageBubble

Single chat message bubble.

import { MessageBubble } from '@ybouhjira/hyperkit';

#Playground

Edit the code — the preview recompiles and re-renders as you type.

Live playground
Loading preview…

#More Examples

Assistant Message

<MessageBubble
  role="assistant"
  content={"You can use `Array.prototype.sort()`:\n\n

Streaming

<MessageBubble
  role="assistant"
  content="Let me think about this..."
  isStreaming
/>

#Props

PropTypeDefaultDescription
role *MessageRole
content *string
timestampDate
isStreamingboolean
onCopy() => void
classstring
variant'default' | 'borderless'Variant: 'default' = colored bubble, 'borderless' = transparent thread-style
avatarTextstringAvatar text (e.g., "Y" for user, "AI" for assistant) - only shown in borderless variant
displayNamestringDisplay name (e.g., "You", "Assistant") - only shown in borderless variant

* required prop.

#Design Tokens

This component reads the following CSS custom properties. Override them globally or per-instance to restyle it — see the CSS Variables guide.

  • --sk-accent
  • --sk-bg-primary
  • --sk-bg-secondary
  • --sk-bg-tertiary
  • --sk-border
  • --sk-duration-fast
  • --sk-duration-pulse
  • --sk-ease-in-out
  • --sk-font-size-base
  • --sk-font-size-sm
  • --sk-font-size-xs
  • --sk-message-avatar-font-size
  • --sk-message-avatar-size
  • --sk-message-body-indent
  • --sk-message-borderless-padding
  • --sk-message-header-gap
  • --sk-message-header-time-font-size
  • --sk-message-header-time-opacity
  • --sk-message-name-font-size
  • --sk-radius-md
  • --sk-radius-sm
  • --sk-space-sm
  • --sk-space-xl
  • --sk-space-xs
  • --sk-text-muted
  • --sk-text-on-accent
  • --sk-text-primary
  • --sk-text-secondary
  • --sk-warning