DocsComponentsTemplatesThemesGitHub

Docs

Custom styles

Fruit Design is styled with CSS variables. Change a variable once and every component follows. Put your changes in a file that loads after the Fruit Design styles.

Open the theme builder

/* theme.css */
@import '@fruit-labs/design/tokens.css';
@import '@fruit-labs/design/styles.css';

:root {
  --radius-md: 8px;
}

Want to click instead of type? Use the theme builder at https://design.fruitlabs.online/themes/ and copy the CSS it makes.

Border radius

Each size controls a family of components.

  • --radius-xs (6px): checkboxes and small details
  • --radius-sm (10px): menu items and small icons
  • --radius-md (14px): fields, selects and callouts
  • --radius-lg (22px): cards, tables, calendars and popovers
  • --radius-xl (30px): modals and large panels
  • --radius-pill (999px): buttons, chips and calendar days

Softer corners:

:root {
  --radius-xs: 8px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 36px;
}

Square corners, buttons included:

:root {
  --radius-xs: 0px;
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-xl: 0px;
  --radius-pill: 0px;
}

Always write a unit, such as 0px. A plain 0 breaks the calculations. Round things such as switches, avatars and radio buttons stay round.

Colours

Set the light and dark values. --accent-ink is the accent used for text, so keep its contrast at 4.5:1 or more.

:root, [data-theme="light"] {
  --accent: #7A4DFF;
  --accent-ink: #6236E0;
  --accent-tint: rgba(122, 77, 255, 0.12);
}
[data-theme="dark"] {
  --accent: #7A4DFF;
  --accent-ink: #B9A3FF;
  --accent-tint: rgba(159, 128, 255, 0.2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --accent: #7A4DFF;
    --accent-ink: #B9A3FF;
    --accent-tint: rgba(159, 128, 255, 0.2);
  }
}

Font and shadows

:root {
  --font-sans: 'Inter', system-ui, sans-serif;
  --shadow-card: none;
}

Load the font in your app first.

One part of the page

Set the variables on any element. Only what is inside it changes.

.checkout {
  --accent: #157A35;
  --accent-ink: #146F30;
  --radius-pill: 12px;
}

One component

Most components take className, and some take style. Each component page lists its props.

<Button className="buy">Buy now</Button>
.buy.fd-btn {
  --radius-pill: 10px;
  letter-spacing: 0.02em;
}

Use your own class together with the fd- class, so your rule wins. Do not edit files in node_modules: an update removes your changes.