Composer

The assistant input card. Pin activity chrome, mix layout slots, and compare send/stop states.

Playground

Set each activity state with a button. Mix slots and accents on the same card. Success remounts so the halo replays.

You have reached your usage limit
Ask a question…

AI can make mistakes. Check important info.

Activity

Accent

Slots

Activity states

Working paints the spectrum ring. Success is a one-shot halo. Disabled dims the card.

Idle

Ask a question…

Working

Write a research agent that tracks competitor mentions.

Success

Write a research agent that tracks competitor mentions.

Disabled

Write a research agent that tracks competitor mentions.

Slots

Surfaces the card can attach around the editor: footerStart and footerEnd, the one-row layout="compact", an attachments strip inside the card, validationMessage and disclaimer copy, a tucked bottomElement, an attached topElement (also used for queued actions), a floating topSlot, and an activeSlot takeover such as the question tool.

disclaimer has no background, so it sits on whatever surface hosts the composer.

When topElement stacks several strips, such as a usage notice and the message queue, render one ComposerAttachedWash first and keep the strips transparent. The wash paints a single surface from the top strip down past the card, so it doesn't break around the queue.

Footer start

Ask a question…

Footer end

Ask a question…

Compact

Ask a question…

Validation

Ask a question…

Attachments

brief.pdf
brand-guidelines.docx
Ask a question…

Disclaimer

Ask a question…

AI can make mistakes. Check important info.

Top surface

You have reached your usage limit
Ask a question…

Bottom surface

Ask a question…
Write a research agent
Monitor brand mentions

Top slot

Which brand should this agent use?

The first turn is scoped to this brand.

Ask a question…

Queued actions

2 Queued
  • Compare visibility for Ramp vs Brex
  • Draft a follow-up prompt for citations
Ask a question…

Takeover

Pick a brand to continue.

Question tool

Question
Which brand should this agent use?

Question tool

The ask-user prompt takes over the card through activeSlot. Single choice, multi choice, free text, and multi-step prompts share the same chrome. With layout="compact", pass a compact question tool to promptSlot instead, so it sits above the one-row editor.

Question
Which brand should this agent use?

Send button

Idle dims send. Typing enables it. Streaming swaps the control for stop. Composer renders this button for you; it is exported for custom footers.

Idle

Typing

Streaming

Accents

Working chrome can be tinted with the same appearance tokens as an agent.

Blue

Write a research agent that tracks competitor mentions.

Red

Write a research agent that tracks competitor mentions.

Orange

Write a research agent that tracks competitor mentions.

Green

Write a research agent that tracks competitor mentions.

Purple

Write a research agent that tracks competitor mentions.

Gray

Write a research agent that tracks competitor mentions.

Usage

Composer is presentational. Product chats derive activityState from streaming and submit flags, then pass the result in.

Composer Properties

activityState
'idle''working''success''disabled'

Visual chrome on the card. Working paints the spectrum ring. Success is a one-shot halo. Disabled dims the card and also disables send and design-system Buttons in the footer slots.

Default: idle

activityAccent
string

CSS color for the working spectrum and success pulse. Defaults to fill-blue.

pulseKey
number

Increments so the success halo remounts and replays.

Default: 0

sendState
'idle''typing''streaming'

Send/stop visual role. Derived from activity and sendDisabled when omitted.

sendDisabled
boolean

Blocks submitting a new message. Stopping an in-flight response stays available.

Default: false

onSubmit
() => void

Called when the user submits from the send button.

onStop
() => void

Called when the user clicks stop during streaming.

sendLabel
string

Tooltip and aria label for send.

Default: Send message

stopLabel
string

Tooltip and aria label for stop.

Default: Stop generation

sendText
string

Visible send text, shown in place of the arrow while not streaming.

sendTextIcon
IconValue

Leading icon beside sendText. Takes an icon name or descriptor.

sendLoading
boolean

Shows a spinner on send while a submission is pending.

Default: false

layout
'default''compact'

Compact puts the footer slots, editor, and send on one row and hides attachments.

Default: default

onCompactOverflow
() => void

Called once per compact session when the editor grows past one line. Switch layout back to default here.

footerStart
ReactNode

Slot on the leading edge of the composer footer.

footerEnd
ReactNode

Slot on the trailing edge of the footer, before send/stop.

disclaimer
ReactNode

Helper text rendered below the visible composer card.

topSlot
ReactNode

Floating slot rendered above the card.

promptSlot
ReactNode

Interactive clarification rendered above the editor card, such as a compact question tool.

promptSlotKey
string

Identity used to remount the prompt content when it changes.

topElement
ReactNode

Surface rendered immediately above and behind the composer card. Product queues sit here, not as an activity state.

bottomElement
ReactNode

Surface tucked under the floating card. Paints its own background and rounding.

activeSlot
ReactNode

Replaces the editor and footer when a product flow takes over the card.

isSlotExiting
boolean

Keeps the outgoing activeSlot content mounted out of flow while the editor returns.

hasInteractiveSlot
boolean

Keeps an interactive slot's footer in place while the card height animates.

slotFooterStart
ReactNode

Leading control in the interactive slot's footer rail.

attachments
ReactNode

Attachment strip above the editor. Stays interactive when the card is disabled.

validationMessage
ReactNode

Validation copy rendered beneath the card.

scrollControl
ReactNode

Viewport control above every composer surface. Left unset, the frame reserves its height. Pass null when the surface owns spacing.

children
ReactNode

Editor surface supplied by the consumer.

className
string

Extra classes on the outer frame.

cardProps
HTMLAttributes<HTMLDivElement>

Attributes spread onto the visible card.

wrapperRef
Ref<HTMLDivElement>

Ref to the outer frame.

cardRef
Ref<HTMLDivElement>

Ref to the visible card.

inert
boolean

Marks the whole frame as non-interactive.

ComposerSendButton Properties

stateRequired
'idle''typing''streaming'

Idle is dimmed, typing is enabled, streaming shows stop.

disabled
boolean

Disables send. Ignored while streaming.

onClick
() => void

Send or stop action.

ariaLabel
string

Accessible name. Defaults to Send or Stop from state.

text
string

Visible send text. Turns the circle into a labeled pill. Stop stays circular.

textIcon
IconValue

Leading icon beside text. Ignored without text or while streaming.

loading
boolean

Shows a spinner and disables send. Ignored while streaming.

Default: false

className
string

Extra classes on the button.