Yak Docs
Reference

Styling

Basic Theming

Customize the widget position and color mode with the theme prop:

<YakProvider
  theme={{
    position: "right", // or "left"
    colorMode: "system" // "light", "dark", or "system" (default)
  }}
  {...props}
>
  <YakWidget />
</YakProvider>

Theme Options

OptionTypeDefaultDescription
position"right" | "left""right"Widget position on the screen. For chatbox this is the corner, for drawer this is the side.
colorMode"light" | "dark" | "system""system"Force a specific color mode or follow system preference
displayMode"chatbox" | "drawer""chatbox"Display as a floating chatbox or a full-height side drawer
lightThemeColorsColor customization for light mode
darkThemeColorsColor customization for dark mode

Theme Colors

Customize colors for light and dark modes separately using the light and dark theme properties:

<YakProvider
  theme={{
    position: "right",
    colorMode: "system",
    light: {
      background: "#ffffff",
      border: "#e5e5e5",
      messageBackground: "#dcfce7", // User message bubble color
      placeholderColor: "#a3a3a3", // Input placeholder text
      submitButtonColor: "#171717", // Submit button background
      submitButtonTextColor: "#ffffff", // Submit button icon
      headerIconColor: "#737373", // Header icons
      button: {
        background: "#171717",
        color: "#ffffff",
        border: "#171717",
      },
    },
    dark: {
      background: "#0a0a0a",
      border: "#262626",
      messageBackground: "#166534",
      placeholderColor: "#737373",
      submitButtonColor: "#fafafa",
      submitButtonTextColor: "#171717",
      headerIconColor: "#a3a3a3",
      button: {
        background: "#fafafa",
        color: "#171717",
        border: "#fafafa",
      },
    },
  }}
  {...props}
>
  <YakWidget />
</YakProvider>

ThemeColors Properties

PropertyTypeDescription
backgroundstringMain background color of the chat panel
borderstringBorder color for the chat panel and elements
messageBackgroundstringUser message bubble background color
placeholderColorstringInput placeholder text color
submitButtonColorstringSubmit button background color
submitButtonTextColorstringSubmit button text/icon color
headerIconColorstringHeader icon color (restart and close buttons)
buttonButtonColorsTrigger button customization

ButtonColors Properties

PropertyTypeDescription
backgroundstringButton background color
colorstringButton text/icon color
borderstringButton border color

Display Mode

The widget supports two display modes:

Chatbox (Default)

A floating panel that appears in the corner of the screen:

<YakProvider
  theme={{
    displayMode: "chatbox",
    position: "right"
  }}
  {...props}
>
  <YakWidget />
</YakProvider>

Drawer

A full-height side panel that slides in from the edge of the screen with a backdrop overlay:

<YakProvider
  theme={{
    displayMode: "drawer",
    position: "right" // Drawer appears on right side
  }}
  {...props}
>
  <YakWidget />
</YakProvider>

The position prop controls which side the drawer appears on:

  • "right" → Drawer slides in from the right edge
  • "left" → Drawer slides in from the left edge

Customizing Drawer Width

The default drawer width is 420px. To customize the width, you can override it with CSS:

/* Custom drawer width */
.yak-widget-container.yak-widget-drawer {
  width: 500px !important;
}

/* Responsive drawer width */
@media (min-width: 768px) {
  .yak-widget-container.yak-widget-drawer {
    width: 600px !important;
  }
}

The drawer automatically becomes full-width on mobile screens (below 640px).

Trigger Button

Customize the trigger button label:

<YakWidget triggerLabel="Chat with AI" />

Or add custom CSS:

<YakWidget iframeClassName="custom-iframe-class" />

CSS Variables

The chat interface uses CSS variables for styling. If you self-host the chat UI or have control over the iframe's CSS, override these variables:

Colors

VariableDescriptionDefault
--yak-primary-colorPrimary brand color#171717
--yak-backgroundBackground color#ffffff
--yak-surfaceSurface/secondary background#fafafa
--yak-borderBorder color#e5e5e5
--yak-text-primaryPrimary text color#171717
--yak-text-secondarySecondary text color#737373
--yak-text-mutedMuted text color (placeholder)#a3a3a3
--yak-primary-text-contrastText on primary background#ffffff
--yak-header-icon-colorHeader icon colorvar(--yak-text-secondary)

Message Bubbles

VariableDescriptionDefault
--yak-user-bubble-bgUser message backgroundvar(--yak-primary-color)
--yak-user-bubble-textUser message textvar(--yak-primary-text-contrast)
--yak-assistant-bubble-bgAssistant message backgroundvar(--yak-surface)
--yak-assistant-bubble-textAssistant message textvar(--yak-text-primary)

Spacing & Radius

VariableDescriptionDefault
--yak-radius-smSmall border radius0.375rem
--yak-radius-mdMedium border radius0.5rem
--yak-radius-lgLarge border radius0.75rem
--yak-radius-fullFull border radius9999px

Typography

VariableDescriptionDefault
--yak-font-familyFont familySystem fonts
--yak-font-size-baseBase font size1rem

Dark Mode

By default, the widget automatically supports dark mode based on system preference (prefers-color-scheme). You can override this behavior using the colorMode theme option:

// Force light mode regardless of system preference
<YakProvider theme={{ colorMode: "light" }} {...props}>
  <YakWidget />
</YakProvider>

// Force dark mode regardless of system preference
<YakProvider theme={{ colorMode: "dark" }} {...props}>
  <YakWidget />
</YakProvider>

// Follow system preference (default)
<YakProvider theme={{ colorMode: "system" }} {...props}>
  <YakWidget />
</YakProvider>

Customizing Dark Mode Variables

If you self-host the chat UI, you can customize dark mode variables:

@media (prefers-color-scheme: dark) {
  :root {
    --yak-primary-color: #fafafa;
    --yak-background: #0a0a0a;
    --yak-surface: #171717;
    --yak-border: #262626;
    --yak-text-primary: #fafafa;
    --yak-text-secondary: #a3a3a3;
  }
}

Custom Trigger

Replace the default trigger with your own button:

import { useYak, YakProvider } from "@yak-io/react";

function CustomTrigger() {
  const { openWidget, isWidgetOpen } = useYak();

  if (isWidgetOpen) return null;

  return (
    <button
      onClick={() => openWidget()}
      className="fixed bottom-4 right-4 bg-blue-500 text-white rounded-full p-4 shadow-lg"
    >
      💬 Chat with AI
    </button>
  );
}

function App() {
  return (
    <YakProvider {...props}>
      {/* Don't render YakWidget if using custom trigger */}
      <CustomTrigger />
      {/* Your app */}
    </YakProvider>
  );
}

On this page