v2.15.0

ChatPromptSubmit

Кнопка отправки запроса в чате: сама учитывает статус.

Использование

Компонент ChatPromptSubmit используется внутри ChatPrompt для отправки запроса. Он сам обрабатывает разные значения status и управляет чатом.

Он расширяет компонент Button, поэтому ему можно передать любое свойство: color, size и другие.

<template>
  <B24ChatPrompt>
    <B24ChatPromptSubmit />
  </B24ChatPrompt>
</template>
Его можно разместить и в слоте footer компонента ChatPrompt.

Готов

При статусе ready пропсы color и icon настраивают кнопку. По умолчанию:

  • color="primary"
  • icon="ArrowTopLIcon"
<template>
  <B24ChatPromptSubmit color="air-primary" />
</template>

Отправлено

При статусе submitted пропсы submitted-color и submitted-icon настраивают кнопку. По умолчанию:

  • submittedColor="air-secondary-no-accent"
  • submittedIcon="StopLIcon"
По нажатию на кнопку возникает событие stop.
<template>
  <B24ChatPromptSubmit submitted-color="air-secondary-no-accent" status="submitted" />
</template>

Поток ответа

При статусе streaming пропсы streaming-color и streaming-icon настраивают кнопку. По умолчанию:

  • streamingColor="air-secondary-accent-2"
  • streamingIcon="StopLIcon"
По нажатию на кнопку возникает событие stop.
<template>
  <B24ChatPromptSubmit streaming-color="air-secondary-accent-2" status="streaming" />
</template>

Ошибка

При статусе error пропсы error-color и error-icon настраивают кнопку. По умолчанию:

  • errorColor="air-primary-alert"
  • errorIcon="RefreshIcon"
По нажатию на кнопку возникает событие reload.
<template>
  <B24ChatPromptSubmit error-color="air-primary-alert" status="error" />
</template>

Примеры

Установка, настройка сервера и примеры использования — на обзорной странице Chat.

API

Пропсы

Prop Default Type
as'button'any

The element or component this component should render as when not a link.

status'ready' "error" | "submitted" | "streaming" | "ready"
iconicons.imSendIconComponent

The icon displayed in the button when the status is ready. Set to false to hide the icon.

color'air-primary'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost"

The color of the button when the status is ready.

streamingIconicons.stopIconComponent

The icon displayed in the button when the status is streaming.

streamingColor'air-secondary-accent-2'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost"

The color of the button when the status is streaming.

submittedIconicons.stopIconComponent

The icon displayed in the button when the status is submitted.

submittedColor'air-secondary-no-accent'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost"

The color of the button when the status is submitted.

errorIconicons.reloadIconComponent

The icon displayed in the button when the status is error.

errorColor'air-primary-alert'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost"

The color of the button when the status is error.

autofocus false | true | "true" | "false"
avatar AvatarProps

Display an avatar on the left side.

loadingboolean

When true, the loading icon will be displayed.

disabledboolean
name string
label string
roundedfalseboolean

Rounds the corners of the button

size'md' "xss" | "xs" | "sm" | "md" | "lg" | "xl"
type'button' "reset" | "submit" | "button"

The type of the button when not a link.

activeColor"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost"
depth'normal' "dark" | "light" | "normal"
Deprecated — removed in 3.0.0

Renders nothing on the air-* colours, the default among them: the depth compound variants are keyed on the legacy colour names only.

activeDepth "dark" | "light" | "normal"
Deprecated — removed in 3.0.0

Same as depth — no effect on the air-* colours.

blockfalseboolean

Render the button full width

loadingAutofalseboolean

Set loading state automatically based on the @click promise state

normalCasetrueboolean

Disable uppercase label

useWaitfalseboolean

Shows LoaderWaitIcon in loading mode

useClockfalseboolean

Shows LoaderClockIcon icon in loading mode

useDropdownfalseboolean

Shows a dropdown chevron on the right side, from the dictionary's chevronDown role, so an app.config override reaches it.

b24ui { base?: SlotClass; } & { base?: SlotClass; baseLoading?: SlotClass; baseLoadingWaitIcon?: SlotClass; baseLoadingClockIcon?: SlotClass; baseLoadingSpinnerIcon?: SlotClass; baseLine?: SlotClass; label?: SlotClass; labelInner?: SlotClass; leadingIcon?: SlotClass; leadingAvatar?: SlotClass; leadingAvatarSize?: SlotClass; trailingIcon?: SlotClass; safeList?: SlotClass; }
Компонент поддерживает и все нативные HTML-атрибуты <button>.

Слоты

Slot Type
leading{ b24ui: object; }
default{ b24ui: object; }
trailing{ b24ui: object; }

События

Event Type
stop[event: MouseEvent]
reload[event: MouseEvent]

Тема

https://github.com/bx-shef/b24-ui/tree/main/src/theme/chat-prompt-submit.ts
export default {
  slots: {
    base: 'rounded-full'
  }
}