---
title: "ChatPromptSubmit"
description: "Кнопка отправки запроса в чате: сама учитывает статус."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/chat-prompt-submit"
---
# ChatPromptSubmit

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

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

Компонент ChatPromptSubmit используется внутри [ChatPrompt](https://b24-ui.bx-shef.by/raw/docs/components/chat-prompt.md) для отправки запроса. Он сам обрабатывает разные значения `status` и управляет чатом.

Он расширяет компонент [Button](https://b24-ui.bx-shef.by/raw/docs/components/button.md), поэтому ему можно передать любое свойство: `color`, `size` и другие.

```vue
<template>
  <b24-chat-prompt-submit />
  <template v-slot:code=>
  <pre className=language-vue shiki shiki-themes material-theme-lighter material-theme material-theme-palenight code=<template>
    <B24ChatPrompt>
      <B24ChatPromptSubmit />
    </B24ChatPrompt>
  </template>
   language=vue meta= style=>
  <code __ignoreMap=>
  <span class=line>
  <span class=sMK4o>
  <</span>
  <span class=swJcz>
  template</span>
  <span class=sMK4o>
  >
  </span></span>
  <span class=line>
  <span class=sMK4o>
    <</span>
  <span class=swJcz>
  B24ChatPrompt</span>
  <span class=sMK4o>
  >
  </span></span>
  <span class=line>
  <span class=sMK4o>
      <</span>
  <span class=swJcz>
  B24ChatPromptSubmit</span>
  <span class=sMK4o>
   />
  </span></span>
  <span class=line>
  <span class=sMK4o>
    </</span>
  <span class=swJcz>
  B24ChatPrompt</span>
  <span class=sMK4o>
  >
  </span></span>
  <span class=line>
  <span class=sMK4o>
  </</span>
  <span class=swJcz>
  template</span>
  <span class=sMK4o>
  >
  </span></span></code></pre></template>
</template>
```

> [!NOTE]
> Его можно разместить и в слоте `footer` компонента [`ChatPrompt`](https://b24-ui.bx-shef.by/raw/docs/components/chat-prompt.md).

### Готов

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

- `color="primary"`
- `icon="ArrowTopLIcon"`

```vue
<template>
  <B24ChatPromptSubmit color="air-primary" />
</template>
```

### Отправлено

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

- `submittedColor="air-secondary-no-accent"`
- `submittedIcon="StopLIcon"`

> [!NOTE]
> По нажатию на кнопку возникает событие `stop`.

```vue
<template>
  <B24ChatPromptSubmit submitted-color="air-secondary-no-accent" status="submitted" />
</template>
```

### Поток ответа

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

- `streamingColor="air-secondary-accent-2"`
- `streamingIcon="StopLIcon"`

> [!NOTE]
> По нажатию на кнопку возникает событие `stop`.

```vue
<template>
  <B24ChatPromptSubmit streaming-color="air-secondary-accent-2" status="streaming" />
</template>
```

### Ошибка

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

- `errorColor="air-primary-alert"`
- `errorIcon="RefreshIcon"`

> [!NOTE]
> По нажатию на кнопку возникает событие `reload`.

```vue
<template>
  <B24ChatPromptSubmit error-color="air-primary-alert" status="error" />
</template>
```

## Примеры

> [!TIP]
> See: /docs/components/chat/
> Установка, настройка сервера и примеры использования — на обзорной странице **Chat**.

## API

### Пропсы

```ts
/**
 * Props for the ChatPromptSubmit component
 */
interface ChatPromptSubmitProps {
  /**
   * @default 'ready'
   */
  status?: "error" | "submitted" | "streaming" | "ready" | undefined;
  /**
   * The icon displayed in the button when the status is `ready`. Set to `false` to hide the icon.
   * @default icons.imSend
   */
  icon?: false | (props: HTMLAttributes & VNodeProps & {}, ctx: Omit<{ attrs: Attrs; slots: Readonly<InternalSlots>; emit: (event: string, ...args: any[]) => void; expose: <Exposed extends Record<string, any> = Record<...>>(exposed?: Exposed | undefined) => void; }, "expose">): any | undefined;
  /**
   * The color of the button when the status is `ready`.
   * @default 'air-primary'
   */
  color?: "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 icon displayed in the button when the status is `streaming`.
   * @default icons.stop
   */
  streamingIcon?: (props: HTMLAttributes & VNodeProps & {}, ctx: Omit<{ attrs: Attrs; slots: Readonly<InternalSlots>; emit: (event: string, ...args: any[]) => void; expose: <Exposed extends Record<string, any> = Record<...>>(exposed?: Exposed | undefined) => void; }, "expose">): any | undefined;
  /**
   * The color of the button when the status is `streaming`.
   * @default 'air-secondary-accent-2'
   */
  streamingColor?: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-tertiary" | "air-selection" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-boost" | undefined;
  /**
   * The icon displayed in the button when the status is `submitted`.
   * @default icons.stop
   */
  submittedIcon?: (props: HTMLAttributes & VNodeProps & {}, ctx: Omit<{ attrs: Attrs; slots: Readonly<InternalSlots>; emit: (event: string, ...args: any[]) => void; expose: <Exposed extends Record<string, any> = Record<...>>(exposed?: Exposed | undefined) => void; }, "expose">): any | undefined;
  /**
   * The color of the button when the status is `submitted`.
   * @default 'air-secondary-no-accent'
   */
  submittedColor?: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-tertiary" | "air-selection" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-boost" | undefined;
  /**
   * The icon displayed in the button when the status is `error`.
   * @default icons.reload
   */
  errorIcon?: (props: HTMLAttributes & VNodeProps & {}, ctx: Omit<{ attrs: Attrs; slots: Readonly<InternalSlots>; emit: (event: string, ...args: any[]) => void; expose: <Exposed extends Record<string, any> = Record<...>>(exposed?: Exposed | undefined) => void; }, "expose">): any | undefined;
  /**
   * The color of the button when the status is `error`.
   * @default 'air-primary-alert'
   */
  errorColor?: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-tertiary" | "air-selection" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-boost" | undefined;
  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; } | undefined;
  autofocus?: false | true | "true" | "false" | undefined;
  /**
   * Display an avatar on the left side.
   */
  avatar?: AvatarProps | undefined;
  /**
   * When `true`, the loading icon will be displayed.
   */
  loading?: boolean | undefined;
  disabled?: boolean | undefined;
  form?: string | undefined;
  name?: string | undefined;
  onClick?: (event: MouseEvent): void | ((event: MouseEvent) => void)[] | undefined;
  /**
   * The element or component this component should render as when not a link.
   * @default 'button'
   */
  as?: any;
  label?: string | undefined;
  /**
   * Rounds the corners of the button
   * @default false
   */
  rounded?: boolean | undefined;
  /**
   * @default 'md'
   */
  size?: "xss" | "xs" | "sm" | "md" | "lg" | "xl" | undefined;
  /**
   * The type of the button when not a link.
   * @default 'button'
   */
  type?: "reset" | "submit" | "button" | undefined;
  /**
   * Class to apply when the link is exact active
   */
  exactActiveClass?: string | undefined;
  /**
   * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
   */
  viewTransition?: boolean | undefined;
  formaction?: string | undefined;
  formenctype?: string | undefined;
  formmethod?: string | undefined;
  formnovalidate?: false | true | "true" | "false" | undefined;
  formtarget?: string | undefined;
  activeColor?: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-tertiary" | "air-selection" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-boost" | undefined;
  /**
   * @default 'normal'
   * @deprecated Renders nothing on the `air-*` colours, the default among
   *   them: the `depth` compound variants are keyed on the legacy colour
   *   names only.
   * @removed 3.0.0
   */
  depth?: "dark" | "light" | "normal" | undefined;
  /**
   * @deprecated Same as `depth` — no effect on the `air-*` colours.
   * @removed 3.0.0
   */
  activeDepth?: "dark" | "light" | "normal" | undefined;
  /**
   * Render the button full width
   * @default false
   */
  block?: boolean | undefined;
  /**
   * Set loading state automatically based on the `@click` promise state
   * @default false
   */
  loadingAuto?: boolean | undefined;
  /**
   * Disable uppercase label
   * @default true
   */
  normalCase?: boolean | undefined;
  /**
   * Shows LoaderWaitIcon in loading mode
   * @default false
   */
  useWait?: boolean | undefined;
  /**
   * Shows LoaderClockIcon icon in loading mode
   * @default false
   */
  useClock?: boolean | undefined;
  /**
   * Shows a dropdown chevron on the right side, from the dictionary's
   * `chevronDown` role, so an `app.config` override reaches it.
   * @default false
   */
  useDropdown?: boolean | undefined;
}
```

> [!NOTE]
> See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
> Компонент поддерживает и все нативные HTML-атрибуты `<button>`.

### Слоты

```ts
/**
 * Slots for the ChatPromptSubmit component
 */
interface ChatPromptSubmitSlots {
  leading(): any;
  default(): any;
  trailing(): any;
}
```

### События

```ts
/**
 * Emitted events for the ChatPromptSubmit component
 */
interface ChatPromptSubmitEmits {
  stop: (payload: [event: MouseEvent]) => void;
  reload: (payload: [event: MouseEvent]) => void;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    chatPromptSubmit: {
      slots: {
        base: 'rounded-full'
      }
    }
  }
})
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
