SendButton
Render the send/stop control. Use state=idle | typing | streaming.
Getting Started
$pnpm add @sinups/ai-kit @mantine/core @mantine/hooks @tabler/icons-reactExamples
Idle
Typing
Streaming
Source
The component source as it ships in the package. Useful as a reference, or as a starting point if you want to fork a piece.
input/SendButton.tsx
import React from 'react';
import { Box } from '@mantine/core';
import { IconArrowUp, IconPlayerStopFilled } from '@tabler/icons-react';
import { cx } from '../utils/cx';
import classes from './SendButton.module.css';
export interface SendButtonProps {
/** `idle` when there is nothing to send, `typing` when input is non-empty, `streaming` while a response is in flight */
state: 'idle' | 'typing' | 'streaming';
className?: string;
style?: React.CSSProperties;
}
/** 28px round send / stop indicator rendered inside the composer toolbar */
export function SendButton({ state, className, style }: SendButtonProps) {
return (
<Box className={cx(classes.root, className)} data-state={state} style={style}>
{state === 'streaming' ? (
<IconPlayerStopFilled size={16} className={classes.icon} />
) : (
<IconArrowUp size={16} className={classes.icon} />
)}
</Box>
);
}
SendButton.displayName = 'SendButton';
API reference
Prop
Type
Required
state
'idle' | 'typing' | 'streaming'
Yes
`idle` when there is nothing to send, `typing` when input is non-empty, `streaming` while a response is in flight
className
string
No
style
React.CSSProperties
No