Skip to content

Chat

The whole chat in one tag — a transcript that scrolls, the question panel and a composer — composed for you, or from your own children.

  • <aparte-chat>
On this page
Open

<aparte-chat> lays its children out as a column: the transcript takes the space left and scrolls, the composer keeps its own height below it. Left empty, it composes itself — a transcript, the panel where questions and approvals appear, and a composer with a field and a send button. Put an <aparte-chat-viewport> inside and it uses your children as they are.

The tag draws the chat; something has to answer it. AparteClient listens for the messages it sends and streams the replies back (see Getting started).

Open

chat.viewport is the transcript. Restoring a conversation is appending its messages; the client does the same during a turn.

Open

overlay-composer lets the transcript scroll under the composer, which floats at the bottom: the layout of ChatGPT, where the scrollbar runs the whole height of the column.

Open

Anything you add is another row of the column, in DOM order: a header, a banner above the composer. center-empty keeps the composer centred as a welcome screen until the first message lands, then slides it down; attachments adds the file picker to the composed composer.

html
<aparte-chat disabled=""></aparte-chat>

Installation and the framework-specific traps: React · Vue · Svelte · Angular.

<aparte-chat> · class AparteChat

Attributes

AttributeDescription
placeholderPlaceholder for the composer input (default composition)
disabledDisables the composer
submit-on-enterForwarded to the composer by value: submit-on-enter="false" makes Enter break the line and Shift+Enter send (the bare attribute, or none, keeps the default — Enter sends). The four wrappers expose the same switch as submitOnEnter.
attachmentsAdd the file picker + chips strip to the default composition (opt-in: the host must consume the files — an AparteClient does, a hand-rolled loop must read event.detail.files)
center-emptyCenter the composer as a welcome state until the first message, then slide to the normal layout
data-emptyReflected BY the element while its viewport holds no <aparte-chat-bubble> and is not loading — set again when the conversation is cleared. With or without center-empty: the stylesheet centers the composer through aparte-chat[center-empty][data-empty], and an app styles or scripts its own empty state against aparte-chat[data-empty]. Read-only.
overlay-composerThe ChatGPT anatomy, opt-in: the transcript’s scroll surface spans the whole column and the composer (with the rest of the bottom stack) floats over it, so the scrollbar runs edge to edge instead of stopping at the composer’s top. The viewport measures the stack and publishes --aparte-bottom-inset; content, spacer and the scroll button clear it. Read when the viewport wires its observers — set it in the initial markup. Also honoured on a wrapper’s [data-aparte-chat] root.
framework-managedThe wrapper’s explicit hands-off signal: set it and this element composes none of its own children, because the framework owns them. Read once at connect (it is not observed), so it has to be in the initial markup. Angular’s wrapper sets it on this element — its component selector IS aparte-chat; React/Vue/Svelte render a [data-aparte-chat] div and never create this element at all.

Properties

PropertyTypeDescription
viewport (readonly)AparteChatViewport | nullThe message viewport (yours or the default), or null before connect.
composer (readonly)AparteComposer | nullThe composer (yours or the default), or null before connect.

CSS variables

VariableDefaultDescription
--aparte-chat-bottom-gapvar(--aparte-space-8)Space below the composer, as padding-block-end on the shell (the same rule covers a wrapper’s [data-aparte-chat] root). The gap belongs to this element because padding applied from outside would also shrink the scroll area, stopping the transcript short of the edge instead of scrolling to it.
  • The transcript is a named, focusable role="log", so a screen reader reaches the conversation with the keyboard and hears new messages.
  • Everything inside keeps its own semantics: see Conversation, Message and Composer.
  • Composer — the part of the chat you type in.
  • Conversation — the transcript on its own.
  • Layouts — the chat in a full page, beside a preview, or under a floating composer.