Skip to main content

XSender

Message input area with send button, file attachment support, and speech input.

Source: Re-exported from @ant-design/x. Full documentation: Ant Design X Sender

Basic Usage

import { XSender } from '@vef-framework-react/components';
import { useState } from 'react';

export default function Demo() {
const [value, setValue] = useState('');

return (
<XSender
value={value}
onChange={setValue}
onSubmit={(text) => {
console.log('Send:', text);
setValue('');
}}
placeholder="Ask anything..."
/>
);
}

With Loading (Streaming)

<XSender
value={value}
onChange={setValue}
onSubmit={handleSend}
onCancel={handleCancel}
loading={isStreaming}
placeholder="Ask anything..."
/>

API

PropTypeDefaultDescription
valuestringInput value (controlled)
defaultValuestringInitial value (uncontrolled)
onChange(value: string) => voidInput change handler
onSubmit(value: string) => voidSend button click handler
onCancel() => voidCancel button click handler (shown when loading)
loadingbooleanfalseShow cancel button instead of send
disabledbooleanfalseDisable the sender
placeholderstringInput placeholder
allowSpeechbooleanfalseEnable speech input
headerReactNodeContent above the input
footerReactNodeContent below the input
prefixReactNodeContent before the input
actionsReactNode | falseCustom action buttons

For the full API, see Ant Design X Sender docs.