Skip to content

Prompt Box ​

A frosted multi-line prompt dock with a circular send button, optional character count, and an actions slot for pickers.

Examples ​

With action picker ​

moonbit
@sumi.prompt_box(
  value=current_prompt,
  placeholder="Describe what to create",
  on_input=set_prompt.map(v => _ => v),
  on_send=set_prompt(_ => ""),
  send_disabled=current_prompt.is_empty(),
  actions=@sumi.dropdown_menu(...),
)

Character count ​

moonbit
@sumi.prompt_box(
  value=current,
  rows=3,
  maxlength=120,
  show_count=true,
  on_input=set_prompt.map(v => _ => v),
)

Send button ​

moonbit
@sumi.send_button(aria_label="Send")
@sumi.send_button(disabled=true, aria_label="Send (disabled)")
@sumi.send_button(loading=true, aria_label="Sending")

API ​

prompt_box ​

NameTypeDefaultDescription
value *String—Current text (controlled)
placeholderString""Placeholder text
rowsInt1Visible row count
on_inputEmit[String]—Called on every input
on_sendCmd—Send command (button or ⌘Enter)
send_disabledBoolfalseDisables the send button
send_loadingBoolfalseSwaps the arrow for a spinner
disabledBoolfalseBlocks interaction and dims the control
maxlengthInt—Maximum character count
show_countBoolfalseRenders n / max, red when over
autofocusBool—Focus the control on mount
actionsHtml—Leading slot for pickers and tools
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

send_button ​

The standalone circular send button.

NameTypeDefaultDescription
disabledBoolfalseBlocks interaction and dims the control
loadingBoolfalseSpinner in the disabled tone
stopBoolfalseStop square for halting a generation
on_clickCmd—Click command
idString—Element id
classString—Extra class names
titleString—Native tooltip title
aria_labelString—
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

* required (labelled) parameter — everything else is optional.