Skip to Content
zjkm-ui-ai-elements

Setup

Install zjkm-ui-ai-elements and add its styles.

Install

Terminal
npm i zjkm-ui-ai-elements ai

Requires React 19, Tailwind CSS 4 and ai v6. You don't need to run shadcn init: the shadcn/ui primitives the components use ship inside the package.

Styles

Add this to your main CSS file:

app/globals.css
@import "tailwindcss";
@import "zjkm-ui-ai-elements/styles.css";
@source "../node_modules/zjkm-ui-ai-elements/dist";
@source "../node_modules/streamdown/dist/*.js";
@source "../node_modules/@streamdown/*/dist/*.js";
  • The @source lines let Tailwind generate the classes the components use. Adjust the relative paths so they point at node_modules from your CSS file.
  • The two streamdown lines style Markdown in MessageResponse, Reasoning and other components that render Markdown. With pnpm, streamdown is not hoisted to the top-level node_modules; add public-hoist-pattern[]=*streamdown* to .npmrc, or point the paths at node_modules/.pnpm/node_modules/.
  • styles.css holds the shadcn/ui theme tokens (light and .dark) and sets the default border colour. If your app already has a shadcn theme, skip that import and the components use your tokens.

Verify Installation

app/page.tsx
import {
  Message,
  MessageContent,
  MessageResponse,
} from "zjkm-ui-ai-elements/message";

export default function Page() {
  return (
    <Message from="assistant">
      <MessageContent>
        <MessageResponse>Hello, world!</MessageResponse>
      </MessageContent>
    </Message>
  );
}

Every module is marked "use client", so you can render the components from a Next.js server component.

Next Steps

On this page