@yext/chat-ui-react
TypeScript icon, indicating that this package has built-in type declarations

0.12.1 • Public • Published

chat-ui-react

A library of React Components for powering Yext Chat integrations.

See the full documentation here.

Getting Started

Install the library through NPM:

npm install @yext/chat-ui-react

Once the library and its peer dependencies are installed, our React Components should be nested inside the ChatHeadlessProvider. ChatHeadlessProvider requires a HeadlessConfig object with the appropriate credentials and configurations:

import {
  ChatHeadlessProvider,
  HeadlessConfig,
} from "@yext/chat-headless-react";
import { ChatPanel } from "@yext/chat-ui-react";

const config: HeadlessConfig = {
  apiKey: "<apiKey>",
  botId: "<botId>",
};

function App() {
  return (
    <ChatHeadlessProvider config={config}>
      <ChatPanel />
    </ChatHeadlessProvider>
  );
}

export default App;

Styling

default styling

Tailwind

The component library utilizes Tailwind styling by default. Please make sure that your application's tailwind configuration includes the following:

  • The content field should contain the path to the location of the @yext/chat-ui-react library (e.g., node_modules/@yext/chat-ui-react/lib/**/*.{js,jsx})
  • The default theme should be extended with the custom styling used by the components specified here.

CSS bundle

For projects that do not use Tailwind, a css bundle is exported as part of this package. To use it, you can import the file @yext/chat-ui-react/bundle.css into your normal CSS flow.

Example for Yext Pages:

/* index.css */
@import "@yext/chat-ui-react/bundle.css";

The CSS bundle is scoped to the target class .yext-chat, which is automatically included as a wrapper div in both ChatPanel and ChatPopUp.

custom styling

Projects that use Tailwind may pass Tailwind classnames into the Chat components using the customCssClasses prop:

const customCssClasses: ChatPanelCssClasses = {
  container: "bg-blue-300"
}
<ChatPanel customCssClasses={customCssClasses}>

Projects that don't use Tailwind may target the default styleless classnames added into the html elements within the Chat components and add their own css styling:

.yext-chat-panel__container {
  background-color: blue;
}

Alternatively, user may provide their own classnames using the customCssClasses prop and target that instead

/@yext/chat-ui-react/

    Package Sidebar

    Install

    npm i @yext/chat-ui-react

    Weekly Downloads

    253

    Version

    0.12.1

    License

    BSD-3-Clause

    Unpacked Size

    597 kB

    Total Files

    246

    Last publish

    Collaborators

    • jaredhood
    • jrhoads
    • apavlick
    • ejaffee1
    • ttanushree
    • yext_eng_npm
    • benmcginnis
    • kunal-p
    • tmeyer2115
    • mbowman
    • jronkin_yext
    • ataing
    • svc_jenkins_consulting_yext
    • cblair_yext
    • emilyfranklin
    • willgorick
    • bhaines-yext
    • mkouzel
    • rconsalo
    • jknutsonn
    • tritpham
    • sharvey
    • npatel94
    • alapre
    • johncho92
    • canderson_yext
    • ssaunders
    • rpope
    • eal172
    • peteros
    • ytruong
    • mkilpatrick
    • baigel1
    • ajgist
    • jballschneider
    • eefi
    • pmomesso
    • dkang3021
    • mleifer
    • lymarrie
    • tobyko
    • jfromm
    • dsurducan
    • dgurland
    • zhengzhi
    • slapshot-bot
    • petya182
    • paigep
    • htamirepi
    • dlsgusrn7577
    • bryanreed
    • lilwang
    • afriedman00
    • sre-ops
    • scheerla
    • a_ashwik
    • bajohnson-yext
    • saivythik
    • tarun-revalla-yext
    • manash-rauta
    • gargsi
    • souravkumar
    • yext-bot
    • anguyenyext
    • tsayyapureddi
    • johnnguyen
    • tpotla
    • nbramblett
    • rpope-yext
    • deepakyext
    • sahilvaidya
    • mgdunn2
    • kgerner-yext
    • fondriest
    • sscott24
    • emilyzhang777
    • karthik-surya-yext
    • jgomezy
    • gonzalo-novak
    • mauriciohr-yext
    • lwyattyext
    • qciccoretti
    • rjindal