Chat
Use @zeus-web/chat to build headless ChatGPT-style chat interfaces with Web Components and thin React/Vue wrappers.
@zeus-web/chatAdvancedGenerated
Playground
Source
Choose the framework entry that matches your application.
html
<script type="module">
import '@zeus-web/chat/wc/auto'
</script>
<zw-chat>
<zw-chat-thread slot="thread">
<zw-chat-message role="assistant"> How can I help? </zw-chat-message>
</zw-chat-thread>
<zw-chat-composer slot="composer"></zw-chat-composer>
</zw-chat>tsx
import {
Chat,
ChatComposer,
ChatMessage,
ChatThread,
} from '@zeus-web/chat/react'
export function SupportChat() {
return (
<Chat
thread={
<ChatThread>
<ChatMessage role="assistant">How can I help?</ChatMessage>
</ChatThread>
}
composer={<ChatComposer />}
/>
)
}vue
<script setup lang="ts">
import { Chat, ChatComposer, ChatMessage, ChatThread } from '@zeus-web/chat/vue'
</script>
<template>
<Chat>
<template #thread>
<ChatThread>
<ChatMessage role="assistant">How can I help?</ChatMessage>
</ChatThread>
</template>
<template #composer>
<ChatComposer />
</template>
</Chat>
</template>When to use
- Build AI chat, agent console or conversational assistant UIs.
- Reuse the same chat behavior protocol across native Web Component, React and Vue.
- Keep product styling free while reusing structure, events, methods and accessibility semantics.
When not to use
- Do not treat it as a model request library.
- Do not embed provider request logic inside the components.
- Do not put credentials, secrets or tokens in component props.
- Do not depend on Markdown parsing, syntax highlighting or file-upload transport in this phase.
Install
bash
pnpm add @zeus-web/chatComponent family
zw-chatzw-chat-threadzw-chat-messagezw-chat-composerzw-chat-code-blockzw-chat-tool-callzw-chat-artifactzw-chat-typing
Slots
zw-chat
headersidebarthreadartifactcomposeremptyloadingContent
zw-chat-message
avatarheaderdefaultfooteractions
zw-chat-composer
prefixattachmentssubmitsuffix
zw-chat-code-block
filenameContentlanguageContentactionsdefault
zw-chat-tool-call
summaryinputoutputerroractions
zw-chat-artifact
headerdefaultfooteractions
Events
zw-chat
sendabortregeneratemessage-actionartifact-open
zw-chat-composer
sendvalue-changeattachment-change
zw-chat-message
message-action
zw-chat-code-block
code-action
zw-chat-artifact
artifact-open
Methods
zw-chat
setMessagesappendMessageupdateMessageappendMessagePartcleargetMessagesscrollToBottomemitSendemitAbortemitRegenerateemitMessageActionemitArtifactOpen
zw-chat-thread
scrollToBottom
zw-chat-composer
focusclearsubmit
zw-chat-message
emitAction
zw-chat-code-block
emitAction
zw-chat-artifact
openArtifact
Examples
Native Web Component usage
Use the auto entry and compose chat, thread, message and composer with plain DOM.
ts
import '@zeus-web/chat/wc/auto'
const chat = document.createElement('zw-chat')
const thread = document.createElement('zw-chat-thread')
const composer = document.createElement('zw-chat-composer')
thread.slot = 'thread'
composer.slot = 'composer'
composer.addEventListener('send', event => {
console.log((event as CustomEvent).detail.value)
})
chat.append(thread, composer)
document.body.append(chat)React wrapper usage
Use the generated React wrapper when the host application is React.
tsx
import { Chat, ChatComposer, ChatThread } from '@zeus-web/chat/react'
export function App() {
return (
<Chat emptyText="No messages">
<ChatThread slot="thread" />
<ChatComposer slot="composer" placeholder="Type a message..." />
</Chat>
)
}AI usage hints
- Compose zw-chat, zw-chat-thread, zw-chat-message and zw-chat-composer when generating a chat interface.
- Use zw-chat-code-block for code; do not put a syntax-highlighting library in the chat root.
- Use the matching zw-chat-artifact slot for an artifact or canvas area.
- Use zw-chat-tool-call to display tool calls.
- Keep business request logic in the application layer.