[Feature] Add Message component

Merged
DJ
5mo ago
+1231-0

Description

Ports the shadcn Message component to RubyUI — the higher-level chat layout that pairs an avatar with bubbles, headers, and footers.

Stacked on #445 (Bubble). Base is feat/bubble-component; this PR shows only the Message diff. Retarget to main once #445 merges.

Reference:

Closes #444.

What's included

  • Message — row container, align: (start/end); flips avatar/content via flex-row-reverse
  • MessageGroup — stacks messages
  • MessageAvatar — wraps the existing Avatar; anchors to the row bottom and lifts when a footer is present
  • MessageContent — column holding bubbles; drives bubble alignment via group-data-[align=end]/message
  • MessageHeader / MessageFooter — muted meta lines (name, timestamp, "Delivered")

Reuse — no new primitives

  • Avatar (existing) inside MessageAvatar
  • Bubble / BubbleContent / BubbleGroup / BubbleReactions (#445) inside MessageContent

Bubble alignment inside a message is handled entirely by Message — Bubble is unchanged. dependencies.yml: message depends on Avatar + Bubble.

Notes

  • shadcn ships these styles as a custom cn-message-* CSS layer; this port translates every rule to Tailwind v4 utilities. No custom CSS, no JS.
  • Marker (the "is typing…" indicator) is a separate shadcn component, out of scope here; the demo uses plain footer text instead.

Testing

  • cd gem && bundle exec rake → tests + StandardRB green.
  • Docs page rendered locally at /docs/message: conversation, header/footer, alignment, and group all verified visually against the shadcn demo.

Screenshots

Add before/after screenshots of /docs/message.


Summary by cubic

Add a chat Message layout that pairs an avatar with bubbles, headers, and footers to build aligned, grouped conversations. Ships with Tailwind v4 utilities and a docs page; no custom CSS or JS.

  • New Features

    • Message with align: :start|:end; controls bubble alignment and flips rows.
    • Subcomponents: MessageGroup, MessageAvatar, MessageContent, MessageHeader, MessageFooter.
    • Docs at /docs/message with examples; routes, controller, nav, sitemap, and LLM docs maps updated.
    • Tests for slots, alignment, and grouping.
    • MCP registry updated with Message files, metadata, and examples.
  • Dependencies

    • Updated dependencies.yml: message depends on Avatar and Bubble; Bubble is unchanged.