O componente ChatPromptSubmit é usado dentro do componente ChatPrompt para enviar o prompt. Ele trata automaticamente os diferentes valores de status para controlar o chat.
Ele estende o componente Button, então você pode passar qualquer propriedade como color, variant, size, etc.
<template>
<NChatPrompt>
<NChatPromptSubmit />
</NChatPrompt>
</template>
footer do componente ChatPrompt.Quando o status dele é ready, use as props color, variant e icon para personalizar o Button. O padrão é:
color="primary"variant="solid"icon="i-lucide-arrow-up"<template>
<NChatPromptSubmit color="primary" variant="solid" icon="i-lucide-arrow-up" />
</template>
Quando o status dele é submitted, use as props submitted-color, submitted-variant e submitted-icon para personalizar o Button. O padrão é:
submittedColor="neutral"submittedVariant="subtle"submittedIcon="i-lucide-square"stop é emitido quando o usuário clica no Button.<template>
<NChatPromptSubmit
submitted-color="neutral"
submitted-variant="subtle"
submitted-icon="i-lucide-square"
status="submitted"
/>
</template>
Quando o status dele é streaming, use as props streaming-color, streaming-variant e streaming-icon para personalizar o Button. O padrão é:
streamingColor="neutral"streamingVariant="subtle"streamingIcon="i-lucide-square"stop é emitido quando o usuário clica no Button.<template>
<NChatPromptSubmit
streaming-color="neutral"
streaming-variant="subtle"
streaming-icon="i-lucide-square"
status="streaming"
/>
</template>
Quando o status dele é error, use as props error-color, error-variant e error-icon para personalizar o Button. O padrão é:
errorColor="error"errorVariant="soft"errorIcon="i-lucide-rotate-ccw"reload é emitido quando o usuário clica no Button.<template>
<NChatPromptSubmit
error-color="error"
error-variant="soft"
error-icon="i-lucide-rotate-ccw"
status="error"
/>
</template>
| Prop | Default | Type |
|---|---|---|
as | 'button' | anyThe element or component this component should render as when not a link. |
status | 'ready' | "error" | "ready" | "submitted" | "streaming" |
icon | appConfig.ui.icons.arrowUp | anyThe icon displayed in the button when the status is |
color | 'primary' | "error" | "primary" | "secondary" | "accent" | "success" | "info" | "warning" | "neutral"The color of the button when the status is |
variant | 'solid' | "link" | "outline" | "soft" | "subtle" | "ghost" | "solid"The variant of the button when the status is |
streamingIcon | appConfig.ui.icons.stop | anyThe icon displayed in the button when the status is |
streamingColor | 'neutral' | "error" | "primary" | "secondary" | "accent" | "success" | "info" | "warning" | "neutral"The color of the button when the status is |
streamingVariant | 'subtle' | "link" | "outline" | "soft" | "subtle" | "ghost" | "solid"The variant of the button when the status is |
submittedIcon | appConfig.ui.icons.stop | anyThe icon displayed in the button when the status is |
submittedColor | 'neutral' | "error" | "primary" | "secondary" | "accent" | "success" | "info" | "warning" | "neutral"The color of the button when the status is |
submittedVariant | 'subtle' | "link" | "outline" | "soft" | "subtle" | "ghost" | "solid"The variant of the button when the status is |
errorIcon | appConfig.ui.icons.reload | anyThe icon displayed in the button when the status is |
errorColor | 'error' | "error" | "primary" | "secondary" | "accent" | "success" | "info" | "warning" | "neutral"The color of the button when the status is |
errorVariant | 'soft' | "link" | "outline" | "soft" | "subtle" | "ghost" | "solid"The variant of the button when the status is |
autofocus | false | true | "true" | "false" | |
avatar | AvatarPropsDisplay an avatar on the left side. | |
loading | boolean When | |
loadingIcon | appConfig.ui.icons.loading | anyThe icon when the |
disabled | boolean | |
name | string | |
label | string | |
size | 'md' | "xs" | "sm" | "md" | "lg" | "xl" |
leading | boolean When | |
leadingIcon | anyDisplay an icon on the left side. | |
trailing | boolean When | |
trailingIcon | anyDisplay an icon on the right side. | |
type | 'button' | "reset" | "submit" | "button"The type of the button when not a link. |
activeColor | "error" | "primary" | "secondary" | "accent" | "success" | "info" | "warning" | "neutral" | |
activeVariant | "link" | "outline" | "soft" | "subtle" | "ghost" | "solid" | |
square | boolean Render the button with equal padding on all sides. | |
block | boolean Render the button full width. | |
loadingAuto | boolean Set loading state automatically based on the | |
ui | { base?: SlotClass; } & { base?: SlotClass; label?: SlotClass; leadingIcon?: SlotClass; leadingAvatar?: SlotClass; leadingAvatarSize?: SlotClass; trailingIcon?: SlotClass; } |
| Slot | Type |
|---|---|
leading | { ui: object; } |
default | { ui: object; } |
trailing | { ui: object; } |
| Event | Type |
|---|---|
stop | [event: MouseEvent] |
reload | [event: MouseEvent] |
export default defineAppConfig({
ui: {
chatPromptSubmit: {
slots: {
base: ''
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nitro/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
chatPromptSubmit: {
slots: {
base: ''
}
}
}
})
]
})