Skip to content
Klarhimmel UI
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.

States

assistant composer in 5 forms: ready, filled, sending, disabled, over-limit.

  • state: ready

    first-file.pdf · 00 KBsecond-file.csv · 00 KB
  • state: filled

    first-file.pdf · 00 KBsecond-file.csv · 00 KB
  • state: sending

    first-file.pdf · 00 KBsecond-file.csv · 00 KB
  • state: disabled

    first-file.pdf · 00 KBsecond-file.csv · 00 KB

    Say why writing is closed and how to carry on.

  • state: over-limit

    first-file.pdf · 00 KBsecond-file.csv · 00 KB
    000 / 000

    Say by how much it is over and what to do to send it.

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 state prop drives the box: value and attachments are the draft, hint and counter say how to send and how far over, notice explains a disabled box. Send, stop and remove labels are the button words.

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.

Other states

The states of every assistant component, side by side.

Install

Installs

app-assistant-composer
Uses
  • ChatComposer
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.
States
Ready, filled, sending, disabled, over the limit, drawn by ChatComposer. Enter sends, Shift+Enter adds a line. New project? Set it up once: /get-started/installation.