> ## Documentation Index
> Fetch the complete documentation index at: https://docs.remark.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing custom CSS

> Style Remark elements and exported parts on your storefront.

Use custom CSS for changes beyond the dashboard's appearance settings. The stylesheet runs on your storefront page and reaches widget internals through exported CSS parts. Read the theme token reference and the parts reference for the surface you want to change.

[Theme tokens](https://docs.remark.ai/sdk/styling/tokens.md) · [Activator parts](https://docs.remark.ai/sdk/styling/parts/activators.md) · [Chat shell parts](https://docs.remark.ai/sdk/styling/parts/chat.md) · [Message and content parts](https://docs.remark.ai/sdk/styling/parts/messages.md) · [Overlay parts](https://docs.remark.ai/sdk/styling/parts/overlays.md)

## Cascade

Normal page declarations on an exported part take precedence over the widget's own normal styles, including inline styles. Variables set on a Remark host override its token defaults. Other stylesheets on your page still compete by specificity and order. With `!important`, shadow-tree declarations take precedence over important page declarations.

## Host layout

Remark elements start with `display: inline` and reset inherited properties. Set `display: block` before applying block margins or a maximum inline size to the element itself. The dashboard preview lays out the element as a flex item, so check placement on your storefront too.

## State

Scope scene-specific rules with `data-scene` and light- or dark-specific rules with `data-color-scheme`. The widget sets these attributes to report its state. Changing them from the page does not change the widget's state.

## Dashboard preview

The dashboard preview removes positioning properties from host selectors and outer layout parts to keep the widget inside the preview frame. Verify placement on your storefront, and check each scene and color scheme affected by your CSS. Check that the CSS block is complete before saving: an unfinished rule can be accepted even when the browser does not apply all of it.

## Fonts

The dashboard Font Family field sets `--remark-fonts-sans`; setting the variable on the host element has the same effect. The semantic tokens `--remark-fonts-heading`, `--remark-fonts-content`, `--remark-fonts-interface`, and `--remark-fonts-display` default to the sans stack and can be set independently. Heading text styles use semibold (600), so check a font's available weights before choosing it. The dashboard preview auto-loads popular Google Fonts. Load the chosen font on the storefront as well, using its provider's stylesheet or a document-level `@font-face` rule. The family name must match the widget setting or CSS variable.

## Targeting Parts in Your CSS

Every selector must include a Remark custom element or `[data-remark]`. Use `[data-remark]` for shared rules, including overlay hosts. Descendant selectors after `::part()` do not reach internal children; target an exported part instead.

Use `::part()` on a Remark element. `[data-remark]` styles a part wherever it appears, which suits brand-wide rules. Name a specific element, such as `remark-chat-widget` for the floating chat or `remark-qa-activator` for the embedded chat (inline activator), to style only that surface:

```css theme={null}
/* Every Remark element: give prompt text a heavier weight */
[data-remark]::part(prompt-button) {
  font-weight: var(--remark-font-weights-medium);
}

/* Floating chat: add a bottom border to the header during a conversation */
remark-chat-widget[data-scene='chat']::part(widget-header) {
  border-block-end: 1px solid var(--remark-colors-border-subtle);
}

/* Embedded chat: hide the expert tagline */
remark-qa-activator::part(expert-intro-tagline) {
  display: none;
}

/* Floating chat: hide prompt bubbles above the button activator */
remark-chat-widget::part(floating-activator-prompts) {
  display: none;
}
```

Live view and the review summary drawer open in a full-page layer attached to the end of the page rather than inside the element that launched them. Style their parts with `[data-remark]`, such as `[data-remark]::part(drawer)`, since an element name like `remark-reviews` doesn't reach them.

A common use case for the embedded chat is adding spacing above or below the widget to separate it from surrounding page content:

```css theme={null}
/* Add vertical spacing around the embedded chat */
remark-qa-activator::part(parent-container) {
  margin-block: 2rem;
}
```

You can use nested media queries to apply different styles at different viewport sizes:

```css theme={null}
remark-qa-activator {
  @media (min-width: 50rem) {
    --hem: 18px;
  }
}
```

In this example, the embedded chat uses the default base font size (16 px) on smaller screens and bumps it up on larger viewports.

CSS nesting works inside an element selector, as in the example above, but not inside a `::part()` rule. A rule nested in a `::part()` block never matches, while the outer rule still applies, so the mistake is easy to miss. Attach pseudo-classes and pseudo-elements to the part directly:

```css theme={null}
/* Matches: the pseudo-class is attached to the part */
remark-chat-widget::part(prompt-button):hover {
  background-color: var(--remark-colors-background-hover);
}

/* Never matches: the pseudo-class is nested inside the part rule */
remark-chat-widget::part(prompt-button) {
  &:hover {
    background-color: var(--remark-colors-background-hover);
  }
}
```

> [!NOTE]
>
> Some parts are only present in specific UI states. For example, `more-options-menu` and `layout-menu` are only rendered while those dropdowns are open, and `skeleton` parts are only present while the widget is loading.

## Full Example

This example shows custom CSS that adjusts sizing tokens and styles individual parts. Colors and font family would typically be set through the dashboard rather than in CSS.

```css theme={null}
/* Sizing on every Remark element */
[data-remark] {
  --hem: 18px;
  --remark-spacing-multiplier: 1.25;
  --remark-radii-base: 0.75rem;

  &::part(chat-header-tagline) {
    color: var(--remark-colors-content-muted);
  }
}

/* Floating chat: pad the header during a conversation */
remark-chat-widget[data-scene='chat']::part(widget-header) {
  padding-block: 1rem;
  padding-inline: 1.25rem;
}

/* Embedded chat: outline product recommendations */
remark-qa-activator::part(product-recommendation) {
  border: 1px solid var(--remark-colors-border-subtle);
}
```

## Best Practices

* **Use widget settings first.** The dashboard handles colors, typography, spacing, and border radius with built-in dark mode support. Reach for custom CSS only when you need to style a specific element differently.
* **Reference token variables in `::part()` rules.** When writing custom CSS, use the `--remark-colors-*` tokens rather than hardcoded color values so your overrides adapt to light and dark mode.
* **Style semantic parts, not layout wrappers.** Prefer parts like `widget-header` or `product-recommendation` over incidental containers.
* **Scope by scene with `data-scene`.** Parts like `widget-header`, `header-menu-close-button`, and `prompt-button` match all scenes. Add a scene to the element selector (e.g., `remark-chat-widget[data-scene='chat']::part(widget-header)`) to style a specific context. Keep base styling in unscoped rules, because the element sets `data-scene` only after the widget loads.
* **Account for stateful parts.** Menu, loading, and prompt parts may only render in specific states. Test your overrides in those states.
* **Check responsive layouts.** Header menus, product cards, activators, and input affordances can shift across screen sizes.

## Beyond CSS

For designs that go further than settings and custom CSS can reach — a fully custom activator built into your product grid, redesigned widget surfaces, or a bespoke theme — Remark supports brand-specific widget extensions built and maintained by our team. If you have a design in mind, contact your Remark representative to discuss what's possible.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.