v2.1.8
/
  • Get Started
  • Components
  • Composables
  • Typography
  • GitHub
  • Layout
  • App
  • Container
  • Error
  • SidebarLayout
  • Element
  • Advice
  • Alert
  • Avatar
  • AvatarGroup
  • Badge
  • Banner
  • Button
  • Calendar
  • Card
  • Chip
  • Collapsible
  • Countdown
  • FieldGroup
  • Kbd
  • Progress
  • Separator
  • Skeleton
  • Form
  • Checkbox
  • CheckboxGroup
  • ColorPicker
  • FileUpload
  • Form
  • FormField
  • Input
  • InputDate
  • InputMenu
  • InputNumber
  • InputTags
  • InputTime
  • PinInput
  • RadioGroup
  • Range
  • Select
  • SelectMenu
  • Switch
  • Textarea
  • Data
  • Accordion
  • DescriptionList
  • Empty
  • Table
  • TableWrapper
  • Timeline
  • User
  • Navigation
  • Breadcrumb
  • CommandPalette
  • Link
  • NavigationMenu
  • Pagination
  • Stepper
  • Tabs
  • Overlay
  • ContextMenu
  • DropdownMenu
  • Modal
  • Popover
  • Slideover
  • Toast
  • Tooltip
  • Page
  • PageCard
  • PageColumns
  • PageGrid
  • PageLinks
  • PageList
  • Dashboard
  • DashboardGroup
  • DashboardSearch
  • DashboardSearchButton
  • AI Chat
  • soonChatMessage
  • soonChatMessages
  • soonChatPalette
  • soonChatPrompt
  • soonChatPromptSubmit
  • Content
  • ContentSearch
  • ContentSearchButton
  • ContentSurround
  • ContentToc
  • Color Mode
  • ColorModeAvatar
  • ColorModeButton
  • ColorModeImage
  • ColorModeSelect
  • ColorModeSwitch
  • i18n
  • LocaleSelect
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.8
  • Docs
  • Components
  • Composables
  • Typography

ChatPromptSubmit

A chat prompt submission button with automatic status handling.
Button
GitHub
Nuxt UI
We are still updating this page. Some data may be missing here — we will complete it shortly.

Usage 2.2+

The ChatPromptSubmit component is used inside the ChatPrompt component to submit the prompt. It automatically handles the different status values to control the chat.

It extends the Button component, so you can pass any property such as color, size, etc.

<template>
  <B24ChatPrompt>
    <B24ChatPromptSubmit />
  </B24ChatPrompt>
</template>
You can also use it inside the footer slot of the ChatPrompt component.

Ready

When its status is ready, use the color and icon props to customize the Button. Defaults to:

  • color="primary"
  • icon="ArrowTopLIcon"
{
  "wait": "Loading client-side content..."
}

Submitted

When its status is submitted, use the submitted-color and submitted-icon props to customize the Button. Defaults to:

  • submittedColor="air-secondary-no-accent"
  • submittedIcon="StopLIcon"
The stop event is emitted when the user clicks on the Button.
{
  "wait": "Loading client-side content..."
}

Streaming

When its status is streaming, use the streaming-color and streaming-icon props to customize the Button. Defaults to:

  • streamingColor="air-secondary-accent-2"
  • streamingIcon="StopLIcon"
The stop event is emitted when the user clicks on the Button.
{
  "wait": "Loading client-side content..."
}

Error

When its status is error, use the error-color and error-icon props to customize the Button. Defaults to:

  • errorColor="air-primary-alert"
  • errorIcon="RefreshIcon"
The reload event is emitted when the user clicks on the Button.
{
  "wait": "Loading client-side content..."
}

Examples

These chat components are designed to be used with the AI SDK v5 from Vercel AI SDK.

Within a page

Use the ChatPromptSubmit component with the Chat class from AI SDK v5 to display a chat prompt within a page.

Pass the status prop and listen to the stop and reload events to control the chat.

pages/[id].vue
<script setup lang="ts">
import { Chat } from '@ai-sdk/vue'
import { getTextFromMessage } from '@bitrix24/b24ui-nux/utils/ai'

const input = ref('')

const chat = new Chat({
  onError(error) {
    console.error(error)
  }
})

function onSubmit() {
  chat.sendMessage({ text: input.value })

  input.value = ''
}
</script>

<template>
  <B24Card>
    <B24Container>
      <B24ChatMessages :messages="chat.messages" :status="chat.status">
        <template #content="{ message }">
          <MDC :value="getTextFromMessage(message)" :cache-key="message.id" class="*:first:mt-0 *:last:mb-0" />
        </template>
      </B24ChatMessages>
    </B24Container>

    <template #footer>
      <B24Container class="pb-4 sm:pb-6">
        <B24ChatPrompt v-model="input" :error="chat.error" @submit="onSubmit">
          <B24ChatPromptSubmit :status="chat.status" @stop="chat.stop()" @reload="chat.regenerate()" />
        </B24ChatPrompt>
      </B24Container>
    </template>
  </B24Card>
</template>

API

Props

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.

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" | "link"

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" | "link"

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" | "link"

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" | "link"

The color of the button when the status is error.

type'button' "reset" | "submit" | "button"

The type of the button when not a link.

avatar AvatarProps

Display an avatar on the left side.

  • as?: any

    The element or component this component should render as. Defaults to 'span'.

  • src?: string
  • alt?: string
  • icon?: IconComponent

    Display an icon on the left side.

  • text?: string
  • size?: "md" | "3xs" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl"

    Defaults to 'md'.

  • chip?: boolean | ChipProps
  • class?: any
  • style?: any
  • b24ui?: { root?: ClassNameValue; image?: ClassNameValue; fallback?: ClassNameValue; icon?: ClassNameValue; }
  • loading?: "lazy" | "eager"
  • referrerpolicy?: HTMLAttributeReferrerPolicy
  • crossorigin?: "" | "anonymous" | "use-credentials"
  • decoding?: "async" | "auto" | "sync"
  • height?: Numberish
  • sizes?: string
  • srcset?: string
  • usemap?: string
  • width?: Numberish
loadingboolean

When true, the loading icon will be displayed.

to string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric

Route Location the link should navigate to when clicked on.

  • name?: RouteRecordNameGeneric
  • params?: RouteParamsRawGeneric
  • path?: undefined

    A relative path to the current location. This property should be removed

  • query?: LocationQueryRaw
  • hash?: string
  • force?: boolean

    Triggers the navigation even if the location is the same as the current one. Note this will also add a new entry to the history unless replace: true is passed.

  • state?: HistoryState

    State to save using the History API. This cannot contain any reactive values and some primitives like Symbols are forbidden. More info at https://developer.mozilla.org/en-US/docs/Web/API/History/state

autofocus false | true | "true" | "false"
disabledboolean
name string
downloadany
hreflang string
media string
ping string
target null | string & {} | "_blank" | "_parent" | "_self" | "_top"

Where to display the linked URL, as the name for a browsing context.

referrerpolicy "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"
activeboolean

Force the link to be active independent of the current route.

isActionboolean

When true, uses special underlined styling.

trailingSlash "append" | "remove"

An option to either add or remove trailing slashes in the href for this specific link. Overrides the global trailingSlash option if provided.

label string
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" | "link"
size'md' "md" | "xs" | "sm" | "lg" | "xl" | "xss"
roundedfalseboolean

Rounds the corners of the button

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 icons.ChevronDownSIcon on the right side

b24ui { base?: ClassNameValue; } & { base?: ClassNameValue; baseLoading?: ClassNameValue; baseLoadingWaitIcon?: ClassNameValue; baseLoadingClockIcon?: ClassNameValue; baseLoadingSpinnerIcon?: ClassNameValue; baseLine?: ClassNameValue; label?: ClassNameValue; labelInner?: ClassNameValue; leadingIcon?: ClassNameValue; leadingAvatar?: ClassNameValue; leadingAvatarSize?: ClassNameValue; trailingIcon?: ClassNameValue; safeList?: ClassNameValue; }
  • base?: ClassNameValue
  • baseLoading?: ClassNameValue
  • baseLoadingWaitIcon?: ClassNameValue
  • baseLoadingClockIcon?: ClassNameValue
  • baseLoadingSpinnerIcon?: ClassNameValue
  • baseLine?: ClassNameValue
  • label?: ClassNameValue
  • labelInner?: ClassNameValue
  • leadingIcon?: ClassNameValue
  • leadingAvatar?: ClassNameValue
  • leadingAvatarSize?: ClassNameValue
  • trailingIcon?: ClassNameValue
  • safeList?: ClassNameValue
This component also supports all native <button> HTML attributes.

Slots

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

Emits

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

Theme

app.config.ts
export default defineAppConfig({
  b24ui: {
    chatPromptSubmit: {
      slots: {
        base: 'rounded-full'
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'

export default defineConfig({
  plugins: [
    vue(),
    bitrix24UIPluginVite({
      b24ui: {
        chatPromptSubmit: {
          slots: {
            base: 'rounded-full'
          }
        }
      }
    })
  ]
})

ChatPrompt

An enhanced Textarea component optimized for prompt submission in AI chat interfaces.

ContentSearch

A ready-to-use Command Palette component for your documentation.

On this page

  • Usage
    • Ready
    • Submitted
    • Streaming
    • Error
  • Examples
    • Within a page
  • API
    • Props
    • Slots
    • Emits
  • Theme
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24