GlassKit UI
Components

ChatBubble

A conversation view. <MessageThread> stacks <ChatBubble>s — from="them" is a surface bubble at the start, from="me" is the accent-gradient bubble at the end. RTL-safe.

Where are you?
Two blocks away
Grab a table?
On it 👍
600 × 600 · live

Installation

npx @glasskit-ui/cli add chat-bubble

Install the SDK (it provides GlassViewport, useDpad and the stylesheet), then copy these files into your project:

npm install @glasskit-ui/react
// components/lib/utils.tsexport type ClassValue = string | number | null | undefined | false;/** * Join truthy class names. Dependency-free on purpose: the lens components * style via bespoke semantic classes (no conflicting Tailwind utilities to * de-dupe), so this needs no clsx/tailwind-merge and resolves from anywhere * the registry is vendored. */export function cn(...inputs: ClassValue[]): string {  return inputs.filter(Boolean).join(" ");}/** * Accessible name from a free-form `label` prop: the label itself when it's a * plain string, otherwise undefined (a ReactNode can't become an aria-label). */export function stringLabel(label: unknown): string | undefined {  return typeof label === "string" ? label : undefined;}
// components/glasskit/chat-bubble.tsximport type { ReactNode } from "react";import { cn } from "../lib/utils";/** * <MessageThread> — a vertical stack of <ChatBubble>s (a conversation view). * Newest at the bottom; scrolls like <List>. RTL-safe (logical alignment). */export function MessageThread({  children,  className,}: {  children: ReactNode;  className?: string;}) {  return <div className={cn("gk-thread", className)}>{children}</div>;}/** * <ChatBubble> — one message. `from="me"` is the accent-gradient bubble aligned * to the inline-end; `from="them"` is a surface bubble at the inline-start. */export function ChatBubble({  from = "them",  children,  className,}: {  from?: "me" | "them";  children: ReactNode;  className?: string;}) {  return (    <div className={cn("gk-bubble", `gk-bubble--${from}`, "t-body", className)}>      {children}    </div>  );}

Usage

<MessageThread>  <ChatBubble from="them">Where are you?</ChatBubble>  <ChatBubble from="me">Two blocks away</ChatBubble></MessageThread>

Props

Prop

Type