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

# Theme, card, popup and button

> How the script's ready-made interface works and how to change it.

Every script starts with a ready-made interface: a floating **button** that opens a **popup**, with **cards** inside it. Everything lives in a Shadow DOM, so the site's CSS does not get in and yours does not leak out.

## Theme (`src/ui/theme.js`)

This is the only place to change colors and shapes. The panel's visual editor writes this file in a commit.

```js theme={null}
// Tema do card, do popup e do botão. Único lugar para trocar cores e formatos.
// O editor visual do painel grava este arquivo num commit.
module.exports = {
  "radius": 16,
  "font": "system-ui, sans-serif",
  "card": {
    "style": "glass"
  },
  "popup": {
    "position": "center",
    "width": 380
  },
  "button": {
    "shape": "pill",
    "position": "bottom-right",
    "label": "Abrir"
  },
  "preset": "doglytdc",
  "colors": {
    "bg": "#0b0712",
    "surface": "#171022",
    "text": "#f5f3ff",
    "muted": "#a59fb8",
    "accent": "#8b5cf6",
    "accent2": "#c084fc",
    "border": "#2c2240"
  }
};
```

| Field | Values |
| - | - |
| `preset` | `doglytdc` (DoglyTdc), `wayground` (Wayground), `lovable` (Lovable), `dark` (Pure dark), `custom` (Custom) |
| `colors` | `bg`, `surface`, `text`, `muted`, `accent`, `accent2`, `border` |
| `radius` | Corners in pixels |
| `font` | CSS font |
| `card.style` | `glass`, `solid` or `outline` |
| `popup.position` | `center`, `right` or `bottom` |
| `popup.width` | From 280 to 640 |
| `button.shape` | `pill`, `rounded` or `square` |
| `button.position` | `bottom-right`, `bottom-left` or `top-right` |
| `button.label` | Button text |

## Create a card

```js theme={null}
popup.body.appendChild(createCard({
  title: "Título",
  text: "Texto",
  actions: [{ label: "Ok", onClick() { /* ... */ } }],
}));
```

## Popup

`createPopup(root, { title })` returns `{ body, open(), close(), toggle() }`. To switch screens, clear it with `popup.body.replaceChildren()` and build the cards again. The popup has `role="dialog"`, `aria-modal`, focuses the Close button when it opens and closes on Esc.

## window\.DoglyScript

On the page, DoglyTdc gives the script:

| Field | What it is |
| - | - |
| `version` | Version currently running |
| `config` | Remote configuration you edit in the panel (without publishing a new version) |
| `reportError(err)` | Sends the error to the panel's Errors tab |

The template uses `config.welcome` as the text of the first card, if you set that key in the remote configuration.

## Don't break it

* Keep everything inside the Shadow DOM (`root`).
* Use `textContent`, never `innerHTML` with text from the site.
* Classes start with `dts-`.
* Respect `prefers-reduced-motion`.


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