2.10.0
中文
Skip to content

Sender ​

Input box component for chatting.

When to use ​

Need to build an input box for a dialogue scenario.

Examples ​

Agent input ​

Basic usage ​

Switch ​

Slot filling ​

Instance methods ​

Submit behavior ​

Voice input ​

Custom voice input ​

Custom suffix actions ​

Expandable panel ​

Slash commands ​

Quote ​

Customize the send button ​

Paste files ​

API ​

SenderProps ​

PropDescriptionTypeDefaultVersion
allowSpeechWhether to allow voice inputbooleanSpeechConfigfalse
autoSizeAdaptive content heightboolean
classNamesStyle class namesSee below--
componentsCustom componentsRecord<'input', ComponentType>--
defaultValueDefault value of the input boxstring--
disabledWhether disabledbooleanfalse-
footerFooter contentVNode(oriNode, info: { components }) => VNodefalse
headerHeader panelVNode(oriNode, info: { components }) => VNodefalse
loadingWhether it is loadingbooleanfalse-
prefixPrefix contentVNode(oriNode, info: { components }) => VNodefalse
readOnlyWhether the input box is read-onlybooleanfalse-
rootClassNameRoot element style classstring--
slotConfigSlot configuration, enable slot fill-in-the-blank modeSlotConfigType[]-2.0
stylesSemantically defined stylesSee below--
submitTypeSubmit modeentershiftEnterfalse
suffixSuffix operation button areaVNode | (oriNode, info: { components }) => VNode | false-2.0
value(v-model)Input box valuestring--
onChangeCallback when input box value changes(value: string, event?: Event, slotConfig?: SlotConfigType[]) => void--
onCancelCallback when cancel button is clicked() => void--
onPasteFileCallback for pasting files(files: FileList) => void--
onSubmitCallback when send button is clicked(message: string, slotConfig?: SlotConfigType[]) => void--
typescript
type SpeechConfig = {
  recording?: boolean;
  onRecordingChange?: (recording: boolean) => void;
};
typescript
type ActionsComponents = {
  SendButton: Component;
  ClearButton: Component;
  LoadingButton: Component;
  SpeechButton: Component;
};
typescript
type SlotConfigType =
  | { type: 'text'; value: string; key?: string }
  | { type: 'input'; key: string; props?: { defaultValue?: string; placeholder?: string } }
  | { type: 'select'; key: string; props?: { defaultValue?: string; options: string[]; placeholder?: string } }
  | { type: 'tag'; key: string; props?: { label: VNode; value?: string } }
  | { type: 'custom'; key: string; props?: Record<string, any>; customRender?: Function; formatResult?: Function };

Sender Slots ​

SlotDescriptionType
headerHeader panel-
prefixPrefix content-
suffixSuffix operation button area{ ori: VNode; info: { components: ActionsComponents } }
footerFooter content{ ori: VNode; info: { components: ActionsComponents } }

Sender Ref ​

PropDescriptionTypeDefaultVersion
nativeElementOuter containerHTMLDivElement--
inputElementInner input elementHTMLTextAreaElement | HTMLDivElement-2.0
focusGet focus(option?) => void--
blurLose focus() => void--
insertInsert content(value, position?) => void-2.0
clearClear content() => void-2.0
getValueGet current value() =>-2.0

Sender.Header ​

PropDescriptionTypeDefaultVersion
childrenPanel contentVNode--
closableWhether it can be closedbooleantrue-
forceRenderForce renderbooleanfalse-
openWhether it is expandedboolean--
titleTitleVNodestring-
onOpenChangeCallback for expansion state change(open: boolean) => void--

Sender.Switch ​

PropDescriptionTypeDefaultVersion
checkedChildrenContent displayed when checkedVNode-2.0
classNamesStyle class namesRecord<'root''content''icon'
defaultValueDefault selected stateboolean-2.0
disabledWhether disabledbooleanfalse2.0
iconIconVNode-2.0
loadingLoading statebooleanfalse2.0
onChangeToggle callback(checked: boolean) => void-2.0
stylesSemantically defined stylesRecord<'root''content''icon'
unCheckedChildrenContent displayed when unselectedVNode-2.0
valueSelected stateboolean-2.0

Semantic DOM ​

  • root
    根节点
  • prefix
    前缀
  • input
    输入框
  • suffix
    后缀
  • footer
    底部
  • switch
    开关
  • content
    内容
Header
Content
  • header
    头部
  • content
    头部-内容

Design Token ​

TokenDescriptionTypeDefault
colorBgSlotSlot background colorstringrgba(colorPrimary, 0.06)
colorTextSlotSlot text colorstringcolorPrimary
colorTextSlotPlaceholderSlot text placeholder colorstringrgba(colorPrimary, 0.25)
colorBorderSlotSlot border colorstringrgba(colorPrimary, 0.06)
colorBorderSlotHoverSlot border hover colorstringrgba(colorPrimary, 0.1)
switchCheckedBgSwitch checked background colorstringrgba(colorPrimary, 0.08)
switchCheckedHoverBgSwitch checked hover background colorstringrgba(colorPrimary, 0.1)
switchUncheckedHoverBgSwitch unchecked hover background colorstringrgba(colorFillTertiary, 0.04)
colorBorderInputInput box border colorstringrgba(colorFillTertiary, 0.1)
colorBgSkillSkill background colorstringrgba(colorPrimary, 0.08)
colorBgSkillHoverSkill hover background colorstringrgba(colorPrimary, 0.15)

colorBgActionsDisabled / colorTextActionsDisabled in React documentation have not yet been exposed in Vue Sender ComponentToken, so they are not included.