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

# Restyle with CSS variables

> Match Loveful's buttons, cards, dialogs and counts to your theme with --loveful-* custom properties, and know which setting wins.

Every look in Loveful's stylesheet reads a `--loveful-*` custom property, with Loveful's default as the fallback. Set the variable and the element follows, with no selectors to fight. The full list is on [CSS variables](https://docs.loveful.app/developers/css-variables.md).

## Where to put your CSS

In the theme's own stylesheet (such as `assets/base.css`), or in **Theme settings > Custom CSS** in the theme editor. Loveful's stylesheet sets none of the variables itself, so yours always apply.

## Who wins

The merchant can also set most of these in Loveful's storefront design window. Its choices are written as the same variables on `:root`, after the theme's stylesheets. So where you set a variable decides who wins:

| You set it on | Result |
| - | - |
| `:root` | A default. A choice made in the design window overrides it. |
| The element, or a wrapper (`loveful-button`, `.product-form`) | Always wins: the closest value is inherited. |

```css theme={null}
/* The merchant can still change this in the design window */
:root {
  --loveful-btn-radius: 999px;
}

/* Always this, whatever the design window says */
.product-form loveful-button {
  --loveful-btn-radius: 999px;
}
```

Use `:root` for a theme you ship to merchants, so they keep control; use a selector for a one-off store build.

## Match the theme's buttons

Point Loveful's variables at the theme's own. Set them on the element, so they resolve inside the theme's colour schemes. For Dawn:

```css theme={null}
loveful-button {
  --loveful-btn-radius: var(--buttons-radius);
  --loveful-btn-border-width: var(--buttons-border-width);
  --loveful-btn-saved-bg: rgb(var(--color-button));
  --loveful-btn-saved-fg: rgb(var(--color-button-text));
}
```

The `--loveful-all-btn-*` variables set every Loveful button at once (save, add to cart, share, dialogs, empty state):

```css theme={null}
:root {
  --loveful-all-btn-bg: #111;
  --loveful-all-btn-fg: #fff;
  --loveful-all-btn-border: #111;
}
```

## A full-width save button

```css theme={null}
.product-form loveful-button {
  --loveful-btn-width: 100%;
  --loveful-btn-padding: 1rem;
  --loveful-btn-font-size: 1rem;
}
```

## Wishlist grid and cards

The Wishlist and Shared wishlist blocks write their column settings inline on their `.loveful-wishlist` wrapper, so set the grid's variables on `.loveful-list` inside it to override them:

```css theme={null}
.loveful-wishlist .loveful-list {
  --loveful-columns: 3;
  --loveful-columns-tablet: 2;
  --loveful-columns-mobile: 1;
  --loveful-gap: 2rem;
  --loveful-card-ratio: 3 / 4;
  --loveful-card-image-radius: 0;
  --loveful-card-title-weight: 400;
}
```

## Dialogs

The list full, sign-in, change options and email dialogs share one set of variables:

```css theme={null}
:root {
  --loveful-dialog-bg: #1a1a1a;
  --loveful-dialog-fg: #f5f5f5;
  --loveful-dialog-radius: 0;
  --loveful-dialog-backdrop: rgba(0, 0, 0, 0.7);
  --loveful-dialog-width: 26rem;
}
```

## State selectors

For anything the variables don't cover, Loveful's elements reflect their state as attributes:

```css theme={null}
loveful-button[data-saved] { /* saved */ }
loveful-button[data-pending] { /* saving or removing */ }
loveful-button[appearance="icon"] { /* card heart */ }
loveful-count[hidden] { /* zero */ }
loveful-share-link[data-pending] { /* making a link */ }
.loveful-card[data-swap-to] { /* options being changed */ }
```

Every element's classes and states are listed with it on [Web components](https://docs.loveful.app/developers/web-components.md).


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