API reference: @salmonui/chat/inline-assist
InlineAssistPropsinterface
import type { InlineAssistProps } from '@salmonui/chat/inline-assist';interface InlineAssistProps {
readonly anchor?: InlineAssistAnchor | null | undefined;
readonly open?: boolean | undefined;
readonly defaultOpen?: boolean | undefined;
readonly onOpenChange?: ((open: boolean, event: InlineAssistOpenChangeEvent) => void) | undefined;
readonly mode?: InlineAssistMode | undefined;
readonly value?: string | undefined;
readonly defaultValue?: string | undefined;
readonly onValueChange?: ((value: string) => void) | undefined;
readonly messages?: readonly InlineAssistMessage[] | undefined;
readonly defaultMessages?: readonly InlineAssistMessage[] | undefined;
readonly onMessagesChange?: ((messages: readonly InlineAssistMessage[], event: InlineAssistMessagesChangeEvent) => void) | undefined;
readonly placeholder?: string | undefined;
readonly adapter?: InlineAssistAdapter | undefined;
readonly selection?: string | undefined;
readonly onBeforeSend?: ((event: InlineAssistBeforeSendEvent) => void) | undefined;
readonly onSend?: ((event: InlineAssistSendEvent) => void) | undefined;
readonly onError?: ((error: unknown) => void) | undefined;
readonly commands?: readonly InlineAssistCommand[] | undefined;
readonly onCommandSelect?: ((event: InlineAssistCommandSelectEvent) => void) | undefined;
readonly responseActions?: readonly InlineAssistResponseAction[] | undefined;
readonly onResponseActionClick?: ((event: InlineAssistResponseActionEvent) => void) | undefined;
readonly onAccept?: ((event: InlineAssistAcceptEvent) => void) | undefined;
readonly onDiscard?: ((event: InlineAssistDiscardEvent) => void) | undefined;
readonly toolbar?: ReactNode;
readonly toolbarPlacement?: 'inline' | 'bottom' | undefined;
readonly renderComposer?: ((props: InlineAssistComposerRenderProps) => ReactNode) | undefined;
readonly renderContent?: ((text: string, options: InlineAssistContentOptions) => ReactNode) | undefined;
readonly returnFocus?: boolean | undefined;
readonly localeText?: InlineAssistLocaleText | undefined;
readonly children?: ReactNode;
readonly className?: string | undefined;
readonly style?: CSSProperties | undefined;
readonly 'aria-label'?: string | undefined;
readonly 'aria-labelledby'?: string | undefined;
readonly ref?: Ref<InlineAssistApi> | undefined;
}
| Name | Signature | Description |
|---|---|---|
anchoroptional | readonly anchor?: InlineAssistAnchor | null | undefined; | Element, text range, viewport point or element ref the popover is placed next to. |
openoptional | readonly open?: boolean | undefined; | |
defaultOpenoptional | readonly defaultOpen?: boolean | undefined; | Applied after hydration (the server renders the assist closed). |
onOpenChangeoptional | readonly onOpenChange?: ((open: boolean, event: InlineAssistOpenChangeEvent) => void) | undefined; | |
modeoptional | readonly mode?: InlineAssistMode | undefined; |
|
valueoptional | readonly value?: string | undefined; | Prompt text (controlled). |
defaultValueoptional | readonly defaultValue?: string | undefined; | |
onValueChangeoptional | readonly onValueChange?: ((value: string) => void) | undefined; | |
messagesoptional | readonly messages?: readonly InlineAssistMessage[] | undefined; | Prompt and response history (controlled). |
defaultMessagesoptional | readonly defaultMessages?: readonly InlineAssistMessage[] | undefined; | |
onMessagesChangeoptional | readonly onMessagesChange?: ((messages: readonly InlineAssistMessage[], event: InlineAssistMessagesChangeEvent) => void) | undefined; | |
placeholderoptional | readonly placeholder?: string | undefined; | |
adapteroptional | readonly adapter?: InlineAssistAdapter | undefined; | Produces the response. |
selectionoptional | readonly selection?: string | undefined; | Selected text passed in the request (default: the text of a |
onBeforeSendoptional | readonly onBeforeSend?: ((event: InlineAssistBeforeSendEvent) => void) | undefined; | |
onSendoptional | readonly onSend?: ((event: InlineAssistSendEvent) => void) | undefined; | |
onErroroptional | readonly onError?: ((error: unknown) => void) | undefined; | The adapter threw. |
commandsoptional | readonly commands?: readonly InlineAssistCommand[] | undefined; | Slash commands, shown as a |
onCommandSelectoptional | readonly onCommandSelect?: ((event: InlineAssistCommandSelectEvent) => void) | undefined; | |
responseActionsoptional | readonly responseActions?: readonly InlineAssistResponseAction[] | undefined; | Actions under a finished response. Default |
onResponseActionClickoptional | readonly onResponseActionClick?: ((event: InlineAssistResponseActionEvent) => void) | undefined; | |
onAcceptoptional | readonly onAccept?: ((event: InlineAssistAcceptEvent) => void) | undefined; | Accept: insert |
onDiscardoptional | readonly onDiscard?: ((event: InlineAssistDiscardEvent) => void) | undefined; | Discard: the response is dropped. Closes the assist. |
toolbaroptional | readonly toolbar?: ReactNode; | Extra controls next to the prompt ( |
toolbarPlacementoptional | readonly toolbarPlacement?: 'inline' | 'bottom' | undefined; | |
renderComposeroptional | readonly renderComposer?: ((props: InlineAssistComposerRenderProps) => ReactNode) | undefined; | Replaces the prompt input. |
renderContentoptional | readonly renderContent?: ((text: string, options: InlineAssistContentOptions) => ReactNode) | undefined; | Renders response text (default: plain text with line breaks). Never receives HTML; bring a Markdown renderer here. |
returnFocusoptional | readonly returnFocus?: boolean | undefined; | Return focus to the element focused before opening (the editor) on close. Default true. |
localeTextoptional | readonly localeText?: InlineAssistLocaleText | undefined; | |
childrenoptional | readonly children?: ReactNode; | Parts in the composer row, such as |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
aria-labeloptional | readonly 'aria-label'?: string | undefined; | |
aria-labelledbyoptional | readonly 'aria-labelledby'?: string | undefined; | |
refoptional | readonly ref?: Ref<InlineAssistApi> | undefined; |