Skip to content
unseen.uiby Stack Unseen
Get started

Customize your components

Wrap your components in AITheme to give them one theme. Its styles only apply inside the wrapper, so they won't clash with the rest of your app.

tsx
import { AITheme, Button } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<AITheme appearance="system" config={{ primary: '#2563eb', density: 'compact', radius: 10 }}>
  <Button>Save changes</Button>
</AITheme>;

Preview and export

Theme Studio restyles this whole site as you browse, so you can try your settings on the homepage, the component examples and the live templates, then copy the configuration into your app. Your choices stay in this browser. Static screenshots and the separate Relay app keep their sample theme.

Theme Studio has light, dark and system appearance, brand and neutral colors, density, borders, corners and motion settings. Status colors keep their meaning. JSON and TypeScript include both palettes; CSS follows the selected appearance. Apply exported CSS to a wrapper with data-ai-theme="brand", or pass an imported theme to AITheme. Its contrast checks cover the palette you set up, not every screen in your app.

Fonts come from the CSS variables --ai-font-family and --ai-font-size. Theme settings also reach dialogs and menus, which render outside the wrapper; your own wrapper styles don't.

Replace icons

Swap icons by name with IconsProvider. Pass the SVG props through and use currentColor, so the icon takes the component's size and color. A nested provider changes icons for just one part of a screen.

tsx
import type { SVGProps } from 'react';
import { IconsProvider, PromptInput } from '@stackunseen/ui';

function SendIcon(props: SVGProps<SVGSVGElement>) {
  return (
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" {...props}>
      <path d="m5 12 14-7-5 14-2-7-7-2Z" />
    </svg>
  );
}

<IconsProvider icons={{ send: SendIcon }}>
  <PromptInput value={draft} onValueChange={setDraft} onSubmit={send} />
</IconsProvider>;

Keep the labels on controls when you replace their icons. A picture alone doesn't tell a screen reader what a button does.

Style a component

Every component takes className and puts it on its root element, after its own classes. The only exceptions have no element of their own: the providers, UnsavedGuard and ConversationMessageActions.

The root also takes the other attributes of its element, such as id, style, data-*, aria-* and event handlers, and a ref. Attributes a component sets itself, such as its role or data-part, win over yours, and a focus handler you pass runs before the component's own. Fourteen components take className only: the overlays (Modal, ArtifactPanel, ShortcutHelp, CommandPalette, Citation, ModelSelector), OrgSwitcher, Chat, CodeEditor, ArtifactEditor, BranchSwitcher, MessageQueue, ThreadList and BackgroundStatus.

Start with the built-in variants and content slots. Use className and style for layout. Not every inner element has a public selector, so check the component's page before you style its internals.

Check your palette in light and dark, and in disabled, focused and error states. A theme change can affect text, control borders and focus rings.

Custom headers and footers

For Modal, pass React content to header and footer. The body scrolls between them, so the actions stay visible in a sheet or fullscreen dialog. Keep title and description: they give the dialog its accessible name and description even when the header looks different. The close button and Escape behavior are kept for you.

tsx
import { useId, useState } from 'react';
import { Button, Input, Modal } from '@stackunseen/ui';

export function ProjectDialog() {
  const [open, setOpen] = useState(false);
  const [name, setName] = useState('My project');
  const formId = useId();

  return (
    <Modal
      open={open}
      onOpenChange={setOpen}
      title="Project details"
      description="Edit the local sample name."
      layout="sheet"
      className="project-dialog"
      trigger={<Button>Edit project</Button>}
      header={
        <div className="project-dialog-heading">
          <strong>Project details</strong>
          <span>Local draft</span>
        </div>
      }
      footer={
        <>
          <Button variant="outline" onClick={() => setOpen(false)}>
            Cancel
          </Button>
          <Button type="submit" form={formId}>
            Use this name
          </Button>
        </>
      }
    >
      <form
        id={formId}
        onSubmit={(event) => {
          event.preventDefault();
          setOpen(false);
        }}
      >
        <label>
          Project name
          <Input value={name} onChange={(event) => setName(event.target.value)} />
        </label>
      </form>
    </Modal>
  );
}

The footer button uses the native form attribute to submit the form in the body. This sample only changes local state; to save a real record, call your API from the submit handler and close the dialog once it succeeds.

Use className or style on Modal for local sizing. To style a particular region, scope its documented data-slot selector to your own class:

css
.project-dialog [data-slot='modal-header'] {
  background: var(--ai-surface-subtle);
}
.project-dialog [data-slot='modal-footer'] {
  gap: 16px;
}
.project-dialog-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

You can omit either slot. Without header, Modal shows its normal title and description. Without footer, your children are the body content.

Card and AlertDialog use composition instead. Put your own content inside Card.Header and Card.Footer, or arrange AlertDialog.Title, AlertDialog.Description and AlertDialog.Actions. AlertDialog does not have Modal's header and footer props.

tsx
<Card className="project-card">
  <Card.Header>
    <Card.Title as="h2">Project overview</Card.Title>
    <Card.Description>Review the current draft.</Card.Description>
  </Card.Header>
  <Card.Content>{content}</Card.Content>
  <Card.Footer className="project-card-footer">{actions}</Card.Footer>
</Card>

If a card has a fixed or minimum height, use a column flex layout and margin-top: auto on your footer class. Card.Footer otherwise follows the content at its natural height.

Backgrounds for light and dark mode

The default palette uses neutral charcoal in dark mode and soft grays in light mode. Dark canvas is #09090b, surface is #18181b, and surface-subtle is #27272a. Those colors are independent of primary; blue is the default primary action and focus color. The default accent is teal.

For a different neutral palette, override the resolved light and dark tokens, then validate the result with importTheme. ThemeInput does not have a background-color option.

tsx
import { AITheme } from '@stackunseen/ui';
import { createTheme, importTheme } from '@stackunseen/ui/theme';

const base = createTheme({ primary: '#2563eb' });
const theme = importTheme(
  JSON.stringify({
    ...base,
    light: {
      ...base.light,
      canvas: '#fafafa',
      surface: '#ffffff',
      'surface-subtle': '#f4f4f5',
      text: '#18181b',
      muted: '#52525b',
      border: '#e4e4e7',
      'control-border': '#71717a',
    },
    dark: {
      ...base.dark,
      canvas: '#09090b',
      surface: '#18181b',
      'surface-subtle': '#27272a',
      text: '#fafafa',
      muted: '#a1a1aa',
      border: '#2e2e33',
      'control-border': '#a1a1aa',
    },
  }),
);

<AITheme theme={theme} appearance="system">
  {children}
</AITheme>;

Theme Studio has a Backgrounds and text section for editing each appearance and exporting both palettes. Choose the same Appearance as the palette you're editing to see it. Changing corners or spacing keeps your overrides. Changing the brand color with updateTheme rebuilds the palette, so reapply your overrides afterwards.

AITheme emits scoped --ai-canvas, --ai-surface, --ai-surface-subtle, --ai-text, --ai-muted, --ai-border and --ai-control-border CSS variables. Use a resolved theme for overrides that should also follow portals. themeToCSS(theme, 'brand', 'system') targets [data-ai-theme="brand"] and switches palettes with the system color preference.

importTheme re-measures the contrast of each color pair, but it doesn't reject a low-contrast palette. Check text at 4.5:1 and control borders and focus rings at 3:1, then look at your real screens. Status colors and their tinted backgrounds need their own checks.

Language and number formats

Wrap your app in AILocale to format numbers, dates and money for one locale. A component's own locale prop still wins. Without either, components format as en-US.

tsx
import { AILocale } from '@stackunseen/ui';

<AILocale locale="de-DE">
  <App />
</AILocale>;

To change or translate a component's built-in wording, pass labels. You only pass the strings you want to replace.

tsx
import { Sources } from '@stackunseen/ui/assistant';

<Sources
  sources={sources}
  labels={{ none: 'Keine Quellen', count: (count) => `${count} Quellen verwendet` }}
/>;

labels is available on ModelSelector, MemoryPanel, WebPreview, Plan, Sources, ChainOfThought, StackTrace, EnvironmentVariables, VoiceSelector, Commit, ArtifactDiff, Pagination, Calendar and DateRangePicker. Other components still use fixed English wording.