Skip to content

I9kChatComposer ​

The free-text answer of an I9kChat footer: a rounded field with a send button. Enter sends; a multiline composer grows with the text and takes Shift+Enter for a new line.

View as MarkdownView source
ts
import { I9kChatComposer } from '@9klabs/design';

Examples ​

Single line ​

vue
<I9kChatComposer v-model="name" label="What's your name?" placeholder="Your name" />

Multiline, invalid ​

vue
<I9kChatComposer v-model="summary" label="What do you need?" multiline invalid />

Watch out ​

  • The composer does not clear itself after submit; reset the bound value when the answer is accepted.
  • Blank and whitespace-only input never emits submit.
  • Error text is yours to render; invalid only styles the field and sets aria-invalid.

API ​

Props ​

PropTypeDefaultRequired
modelValuestring''no
labelstring—yes
placeholderstring''no
sendLabelstring'Send'no
multilinebooleanfalseno
maxlengthnumberundefinedno
invalidbooleanfalseno
disabledbooleanfalseno

Emits ​

EventPayload
update:modelValue[value: string]
submit[value: string]

Agent prompt ​

Paste this into an agent to have it use the component correctly. It is self-contained.

text
Use I9kChatComposer from @9klabs/design in the footer slot of I9kChat when the answer is typed.

import { I9kChatComposer } from '@9klabs/design';

Props:
- modelValue: string — bind with v-model.
- label: string (required) — accessible name of the field; use the question text.
- placeholder?: string.
- sendLabel?: string (default 'Send') — accessible name of the send button; translate it.
- multiline?: boolean — a textarea that grows up to 10rem; Shift+Enter inserts a line break.
- maxlength?: number.
- invalid?: boolean — accent border and aria-invalid; render your error message next to it.
- disabled?: boolean.

Emits:
- update:modelValue(value: string).
- submit(value: string) — Enter or the send button, only for non-blank input. Validate and clear the model yourself.

Exposes: focus().

Usage:
<p v-if="error" role="alert">{{ error }}</p>
<I9kChatComposer v-model="draft" label="What's your name?" placeholder="Your name" :invalid="!!error" @submit="answer" />

Made with love 💚, caffeine, and Claude Code. Built with @9klabs/design itself.