Pular para o conteúdo principal

AppilotsChat

<AppilotsChat/> is the chat UI itself — the floating button, the message thread, the input, and the confirmation cards the agent uses when it needs your approval. Drop it anywhere inside AppilotsProvider.

import { AppilotsProvider, AppilotsChat } from '@appilots/sdk';

function App() {
return (
<AppilotsProvider>
{/* your app */}
<AppilotsChat />
</AppilotsProvider>
);
}

Props

Every branding/theming prop below resolves with the precedence explicit prop → dashboard personalization → SDK default. The dashboard's Personalização values are fetched once on AppilotsProvider mount and act as fallbacks for theme, themeMode, headerTitle/assistantName (via chatTitle/assistantName), assistantAvatar (URL only), emptyStateIcon, welcomeMessage, poweredByVisible, triggerButtonColor, triggerButtonImage (URL only), and locale — a prop you set in code always wins. See Customization → Overview for details and the fetchPersonalization: false opt-out.

PropTypeDefaultDescription
visiblebooleanControlled visibility. When set, the floating action button (FAB) is hidden and you own showing/hiding the chat yourself.
onClose() => voidCalled when the user dismisses the chat. Required alongside visible for controlled usage.
placeholderstringi18n bundleInput placeholder text.
headerTitlestringassistantName prop, then dashboard chatTitle/assistantName, then i18n bundleChat header title.
showActionPreviewsbooleanDeprecated. No longer has any effect — action traces are debug-only and confirmation prompts always remain visible.
autoExecutebooleantrueAuto-execute non-confirm actions without asking for approval. Actions marked confirm always require explicit user approval regardless of this setting.
themePartialThemeTokens | LegacyThemeShapeTheme token overrides, merged onto the resolved light/dark theme. See Theming. The legacy shape (primaryColor, backgroundColor, textColor, inputBackgroundColor, borderRadius, fontFamily) is still accepted and auto-translated.
themeMode'auto' | 'light' | 'dark''auto''auto' follows the device color scheme.
assistantNamestringDisplay name shown in the header.
assistantAvatarstring | number | React.ReactNodeA URL, a require()'d local image, or a React node rendered next to the header title.
emptyStateIconstring | numberDefault ChatIcon glyphAn emoji/string rendered in a tinted badge, or an image (a URL starting with http(s)://, or a require()'d asset) rendered without the tint. Detected automatically — no separate type prop needed.
welcomeMessagestringDefault subtitleSubtitle text shown under the empty-state title.
poweredByVisiblebooleantrueShow or hide the "Powered by Appilots" footer line.
mode'bubble' | 'fullscreen' | 'sidebar' | 'inline''bubble'Layout mode — see Layout modes.
position'bottom-right' | 'bottom-left' | 'top-right' | 'top-left''bottom-right'FAB position. Only used when mode='bubble'.
triggerButtonReact.ReactNode | 'default' | 'none''default'Fully replace the FAB with your own node, or pass 'none' to hide it entirely (useful when you drive visible from your own trigger, e.g. a header icon).
triggerIconReact.ReactNodeReplace only the icon inside the default FAB, keeping its shape and background. Takes priority over triggerButtonImage. Ignored once triggerButton is set to a node.
triggerButtonColorstringtheme.colors.primaryBackground color of the default FAB.
triggerButtonImagestring | numberAn image (URL or require()'d asset) rendered inside the default FAB instead of the built-in chat icon — e.g. a company logo. Ignored when triggerIcon is set.
localeAppilotsLocale ('pt-BR' | 'en' | 'es')Dashboard default locale, then device detectionForce a locale. See Customization: i18n.

Layout modes

ModeBehavior
bubble (default)FAB + bottom-sheet modal.
fullscreenNo FAB — a full-screen modal. Drive it with your own trigger via visible/onClose.
sidebarHalf-width modal pinned to the right on tablet/wide screens. Falls back to a full-width sheet on narrow phones.
inlineRenders in place — no modal, no FAB. Always visible.

Controlled vs. uncontrolled

By default, AppilotsChat manages its own open/closed state internally — the FAB opens it, the user closes it. Pass visible and onClose to control it externally instead. This works in every mode except inline, which is always visible and ignores visible/onClose.

Human escalation

The chat has a built-in "talk to a human" affordance — a headset icon button in the header, plus a chip that's automatically offered when the agent gives up on a request. See Escalation for the full picture.

Examples

Minimal

import { AppilotsProvider, AppilotsChat } from '@appilots/sdk';

function App() {
return (
<AppilotsProvider>
{/* your app */}
<AppilotsChat />
</AppilotsProvider>
);
}

Customized bubble

import { AppilotsProvider, AppilotsChat } from '@appilots/sdk';

function App() {
return (
<AppilotsProvider>
{/* your app */}
<AppilotsChat
assistantName="Ava"
assistantAvatar={require('./assets/ava-avatar.png')}
welcomeMessage="Ask me to find something or fill out a form for you."
position="bottom-left"
triggerButtonColor="#5B4CF0"
theme={{
colors: {
primary: '#5B4CF0',
},
}}
/>
</AppilotsProvider>
);
}

Controlled fullscreen chat

import { useState } from 'react';
import { Button, View } from 'react-native';
import { AppilotsProvider, AppilotsChat } from '@appilots/sdk';

function App() {
const [chatVisible, setChatVisible] = useState(false);

return (
<AppilotsProvider>
<View>
{/* your app */}
<Button title="Ask Ava" onPress={() => setChatVisible(true)} />
</View>
<AppilotsChat
mode="fullscreen"
triggerButton="none"
visible={chatVisible}
onClose={() => setChatVisible(false)}
/>
</AppilotsProvider>
);
}

Next steps