Skip to content
Klarhimmel UI

App, assistant composer

App, assistant composer previewApp, assistant composer preview

Install

npx shadcn add @klarhimmel/app-assistant-composer
DetailsAbout, usage, props and more

The box a person writes to an assistant in, drawn by ChatComposer (the one chat input): a rounded pill with + for files, attachments as chips and a round send.

Import

Import

import Block from '@/components/klarhimmel/blocks/app-assistant-composer';
Also called
  • app/assistant-composer
About
The box a person writes to an assistant in, drawn by ChatComposer (the one chat input): a rounded pill with + for files, attachments as chips and a round send.
Category
Interface sections for signed-in products. New project? Set it up once: /get-started/installation.

Notes

When to use it

The input box at the bottom of an assistant conversation: a labelled textarea, attachment chips, an attach button and send. Use app-assistant-thread for the messages above it; this block only writes, it does not show replies.

Writing for it

- The label (40 characters) is invisible but names the textarea for screen readers, so write what the box is for, such as the question being asked, not the word Message. - Pick state to show one situation: filled and over-limit use value (up to 1200 characters) as the draft, while ready always starts empty and shows the placeholder (80). - At most 3 attachments, each with a name up to 40 characters and a size text of 20. Fill counter and overLimit only for the over-limit state, since they show only there.

Watch out for

Enter sends and Shift+Enter adds a line only when a host wires up onSend. Without it the hint line is hidden and Attach and Stop stay in the tab order but are marked aria-disabled, so the block on its own is a picture of a composer, not a working one.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppAssistantComposer from '@/components/klarhimmel/blocks/app-assistant-composer';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppAssistantComposer props={{
          "label": "Name who the message goes to",
          "state": "filled",
          "placeholder": "Say what to ask or have done…",
          "value": "Write the request in full, in the person's own words: say what to change, for whom and by when. Then add what to tell the people involved. Finish with any note the next person needs.",
          "attachments": [
            {
              "name": "first-file.pdf",
              "size": "00 KB"
            },
            {
              "name": "second-file.csv",
              "size": "00 KB"
            }
          ],
          "attach": "Attach",
          "send": "Send",
          "stop": "Stop",
          "removeLabel": "Remove",
          "hint": "",
          "counter": "000 / 000",
          "overLimit": "Say by how much it is over and what to do to send it.",
          "notice": "Say why writing is closed and how to carry on."
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
labelstring'Name who the message goes to'Text, up to 40 characters.
state'ready' | 'filled' | 'sending' | 'disabled' | 'over-limit''filled'One of 'ready', 'filled', 'sending', 'disabled', 'over-limit'.
placeholderstring'Say what to ask or have done…'Text, up to 80 characters.
valuestring'Write the request in full, in the p…'Text, up to 1200 characters.
attachments{ name, size }[]2 itemsList of up to 3. Each item: name, size.
attachstring'Attach'Text, up to 20 characters.
sendstring'Send'Text, up to 20 characters.
stopstring'Stop'Text, up to 20 characters.
removeLabelstring'Remove'Text, up to 20 characters.
hintstring''Text, up to 120 characters.
counterstring'000 / 000'Text, up to 20 characters.
overLimitstring'Say by how much it is over and what…'Text, up to 120 characters.
noticestring'Say why writing is closed and how t…'Text, up to 120 characters.