Setup
Install zjkm-ui-ai-elements and add its styles.
Install
npm i zjkm-ui-ai-elements aiRequires 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:
@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
@sourcelines let Tailwind generate the classes the components use. Adjust the relative paths so they point atnode_modulesfrom your CSS file. - The two streamdown lines style Markdown in
MessageResponse,Reasoningand other components that render Markdown. With pnpm, streamdown is not hoisted to the top-levelnode_modules; addpublic-hoist-pattern[]=*streamdown*to.npmrc, or point the paths atnode_modules/.pnpm/node_modules/. styles.cssholds 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
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
- Learn how to use components in your application
- Browse the components
- Check troubleshooting if you run into issues