Shadcn/UI 现在默认使用 Base UI,不再使用 Radix。
Shadcn/UI now defaults to Base UI instead of Radix

原始链接: https://ui.shadcn.com/docs/changelog

Shadcn 发布了一套全新的模块化、可组合组件,旨在构建聊天界面。这些组件(MessageScroller、Message、Bubble、Attachment 和 Marker)专为灵活性而设计,允许开发者复制、调整并集成到现有项目中,而非强行要求使用单一框架。 核心组件是 **MessageScroller**,这是一个通过 `@shadcn/react` 包提供的全新无样式(headless)原语。它能够管理复杂的聊天特定行为,如消息锚定、流式传输和滚动恢复,且不限制视觉样式或状态管理。 为了提升视觉效果,此次发布还包含两个新的 Tailwind CSS 工具类:用于平滑边缘过渡的 `scroll-fade` 和用于实时状态指示(如“正在思考……”)的 `shimmer`。 这些组件旨在补充而非替代 AI Elements 等现有 AI 工具。开发者可以逐步采用这些组件,利用无样式的原语处理逻辑,使用已预设样式的注册组件进行快速 UI 开发。通过将核心滚动逻辑与视觉设计分离,Shadcn 为从支持收件箱到定制化 AI 聊天体验等各类应用提供了稳健且面向未来的基础。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交登录 Shadcn/UI 现已将默认底层由 Radix 改为 Base UI (shadcn.com) 13 分,dabinat 发布于 44 分钟前 | 隐藏 | 过往 | 收藏 | 讨论 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

New Chat

How can I help you today?

Morning, shadcn!

What are we working on today? Press send to start a new conversation

Demo is read only. Press send to send messages.

"use client"

import { useChat } from "@ai-sdk/react"

Today, we’re releasing a new set of components for building chat interfaces: MessageScroller, Message, Bubble, Attachment, and Marker.

This is the first phase of the chat components work. We’re taking it one piece at a time, reimagining the abstraction behind each part, and shipping them as shadcn/ui components you can copy, compose, and adapt to your product.

We are starting with the conversation layer: scrolling, message rows, bubbles, attachments, and markers.

We asked ourselves: what makes a great streaming chat experience? Then we abstracted the core rules into a set of primitives: MessageScroller.

MessageScroller is the scroll container for a conversation. It handles the parts that are easy to get wrong: anchored turns, streamed replies, saved thread restore, prepended history, jump-to-message, scroll controls, and visibility tracking.

MessageScroller owns that behavior without owning your messages, AI state, transport, persistence, or model state. You bring the content renderer.

The MessageScroller is also available as an unstyled headless component in @shadcn/react.

The rest of the components cover the everyday pieces you need around the scroller.

  • Message lays out a row in the conversation with avatar, alignment, header, content, footer, and grouped messages.
  • Bubble renders the message surface, with variants, alignment, reactions, links, buttons, and collapsible content.
  • Attachment renders files and images with media, metadata, upload state, actions, and a full-card trigger that keeps actions separately clickable.
  • Marker renders status updates, system notes, bordered rows, and labeled separators for things like streaming state, tool activity, and date breaks.

They are intentionally small. Compose them together for AI chats, support inboxes, team threads, group chats, and product-specific conversations.

We also added two new CSS utilities for the details that make chat interfaces feel better.

scroll-fade adds scroll-aware edge fades to scroll containers. Use it on MessageScroller, ScrollArea, attachment rows, and any long list where you want to hint at more content without adding overlays or scroll listeners.

export function ScrollFadeDemo() {
  return (
    <div className="mx-auto w-full max-w-xs overflow-hidden rounded-2xl border">

shimmer adds a text shimmer for live status. Use it for things like "Thinking…", "Generating response…", running tools, and streaming markers.

export function ShimmerDemo() {
  return (
    <p className="shimmer text-sm text-muted-foreground">

Both utilities ship with shadcn/tailwind.css, so projects initialized with npx shadcn@latest init already have them.

We also created @shadcn/react, a new package for unstyled, headless React components.

The first primitive is @shadcn/react/message-scroller. The registry component wraps it with shadcn/ui styles, but the scroll behavior lives in the package: anchoring, auto-follow, prepend preservation, scroll commands, and visibility.

This lets us ship behavior without locking it to a visual style. You still get copy-and-paste components that match your project, and the hard interaction logic stays tested in one place.

Available now for Radix and Base UI.

This does not replace AI Elements. You can keep using AI Elements for AI interface components and patterns. This release is about bringing the core pieces of chat into shadcn/ui, one component at a time.

If you are already using a component from AI Elements, you do not need to rewrite your app. Keep what works. Try the shadcn/ui version when you want the newer abstraction, the updated styling, or support across Radix and Base UI.

The goal is to make these pieces easy to adopt independently. Replace one part, compose it with what you already have, and keep building.

View Components

联系我们 contact @ memedata.com