Customize
CSS variables
felt-css is plain CSS: every colour, radius, space and shadow is a custom property. Override them to make the toolkit yours — no Sass, no build.
View page source on GitHubOn this page
Naming#
Like Bootstrap's --bs-*, every public variable of felt-css starts with --felt-, so it doesn't collide with your own --primary or --border:
- Global variables on
:root:--felt-primary,--felt-radius,--felt-body-bg… (on this page). - Component variables on the component, named after Bootstrap's:
.btnhas--felt-btn-bgwhere Bootstrap has--bs-btn-bg. Each component page lists them under “CSS”. - Felt variables that only act in the felt look carry a material word: texture, sheet, nap, wool, patch, groove, seam, thread or stitch (
--felt-thread-strength,--felt-patch-shadow). A plain word like--felt-shadowis always a variable of both looks. See Felt. --_namevariables are internal: they may change in any release.
The tables below are generated from the same source as felt.css; the Bootstrap column names the Bootstrap variable each one stands for.
Overriding#
All global variables live in @layer tokens. Any unlayered rule of yours wins over them, so overriding is just redefining:
:root {
--felt-font: "Atkinson Hyperlegible", system-ui, sans-serif;
--felt-radius: 6px;
--felt-container-max: 1200px;
}Variables can also be overridden on any element for that part of the page, like Bootstrap's component variables:
<div style="--felt-primary: var(--felt-moss); --felt-primary-ink: #fff">
<button type="button" class="btn btn-primary">Moss instead of denim</button>
<span class="badge text-bg-primary">Badge</span>
</div>Variables that differ between the looks (most colours, the radii) are set on :root for clean and again on :root[data-look="felt"]. To change a value for one look only, override it there: :root[data-look="felt"] { --felt-radius: 16px; }.
Colors#
Theme colours and the palette are on Color. Body, surfaces and text:
| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-body-bg | light-dark(#f6f7f9, #212529)felt light-dark(#dbcdb7, #242220) | --bs-body-bg | Page background |
--felt-body-color | light-dark(#1f2633, #dee2e6)felt light-dark(var(--felt-navy), #efe7da) | --bs-body-color | Body text |
--felt-emphasis-color | light-dark(#000, #fff)felt light-dark(#0e1526, #fffaf2) | --bs-emphasis-color | Strongest text (.text-body-emphasis) |
--felt-secondary-color | light-dark(#677084, #a2aab4)felt light-dark(#564f41, #b8ad9c) | --bs-secondary-color | Secondary text (.text-body-secondary, .text-muted, form text) |
--felt-tertiary-color | light-dark(#8a92a3, #7d858f)felt light-dark(#8d8574, #8f8676) | --bs-tertiary-color | Tertiary text: disabled links and items, placeholders' neighbours (.text-body-tertiary) |
--felt-surface | light-dark(#fff, #2b3035)felt light-dark(#faf5ee, #34312d) | Cards, list groups, accordions, toasts | |
--felt-surface-sunk | light-dark(#f1f3f5, #1c1f23)felt light-dark(#ece4d4, #2d2a27) | --bs-secondary-bg | Wells, code blocks, readonly fields |
--felt-surface-raised | light-dark(#f8f9fa, #343a40)felt light-dark(#fffcf7, #413c37) | --bs-tertiary-bg | Slightly raised surfaces: light buttons, .alert-light, .table-light |
--felt-surface-overlay | light-dark(#fff, #343a40)felt light-dark(#fdf9f2, #48423c) | Dropdowns, popovers, modals, offcanvas: never darker than what they lie on | |
--felt-surface-hover | light-dark(#eef0f3, color-mix(in oklab, var(--felt-body-color) 8%, var(--felt-surface)))felt light-dark(rgb(90 70 40 / .07), rgb(255 240 220 / .06)) | Hover on neutral surfaces (felt: a translucent shade, so the fibres run through) | |
--felt-surface-pressed | light-dark(#d4d9e0, color-mix(in oklab, var(--felt-body-color) 18%, var(--felt-surface)))felt light-dark(rgb(90 70 40 / .18), rgb(255 240 220 / .14)) | Pressed and chosen neutral surfaces | |
--felt-field | light-dark(#fff, #212529)felt light-dark(#fffdf8, #2b2724) | Inputs and selects | |
--felt-field-addon | light-dark(#f1f3f5, #2b3035)felt light-dark(#f3eee4, #3a3530) | Input-group addons and the file button: a step lighter than the field in dark mode | |
--felt-field-disabled | light-dark(#e9ecef, #343a40)felt light-dark(#e4dac7, #3a3631) | Disabled fields, a step past readonly (--felt-surface-sunk) | |
--felt-field-invalid | var(--felt-field)felt light-dark(#fdf3ee, #3a2823) | Invalid fields | |
--felt-border-width | 1px | --bs-border-width | Hairlines |
--felt-border-style | solid | --bs-border-style | Hairlines |
--felt-border-color | light-dark(#e2e5ea, #41474f)felt light-dark(#c9bba3, #48423b) | --bs-border-color | Hairlines (felt: hidden under the seams, but they keep their width) |
--felt-border-color-strong | light-dark(#858f9e, #737b84)felt light-dark(#847b6a, #857a6c) | Control outlines that reach 3:1 (checkboxes, radios) | |
--felt-link-decoration | underline | --bs-link-decoration | Links |
--felt-link-color | light-dark(var(--felt-primary), #8fb2e8)felt light-dark(#2e5085, #8fb2e8) | --bs-link-color | Links; .link-* set it too |
--felt-track | light-dark(#e3e7ec, #3a4047)felt light-dark(rgb(90 70 40 / .16), rgb(0 0 0 / .36)) | The empty part of progress bars, ranges and the off switch; use it for tracks of your own. Felt: one groove pressed into the felt, translucent | |
--felt-backdrop | light-dark(rgb(16 24 40 / .45), rgb(0 0 0 / .6))felt light-dark(rgb(50 35 15 / .26), rgb(10 8 5 / .5)) | --bs-backdrop-bg--bs-modal-backdrop-bg--bs-offcanvas-backdrop-bg | Modal and offcanvas backdrops |
--felt-highlight-bg | var(--felt-warning-subtle)felt light-dark(#f0d8a2, color-mix(in oklab, var(--felt-warning) 35%, var(--felt-surface))) | --bs-highlight-bg | <mark> and .mark |
--felt-highlight-color | inherit | --bs-highlight-color | Text in <mark> |
--felt-code-color | var(--felt-danger-emphasis) | --bs-code-color | Inline <code> |
Interaction#
| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-hover-ink | light-dark(#000, #fff) | What fills are mixed with on hover | |
--felt-press-ink | #000 | What fills are mixed with when pressed | |
--felt-hover-mix | 8% | How much of it a hovered fill takes | |
--felt-active-mix | 14% | How much of it a pressed fill takes | |
--felt-select-mix | 18% | A neutral button pressed or chosen: a clear step past its hover | |
--felt-disabled-opacity | .55 dark .45 | Disabled controls in the clean look (felt pieces fade into the page instead) | |
--felt-focus-ring-color | light-dark(color-mix(in oklab, var(--felt-link-color) 80%, transparent), color-mix(in oklab, var(--felt-link-color) 60%, transparent)) | --bs-focus-ring-color | Focus rings, 3:1 or more against the page; .focus-ring-* set it too |
--felt-focus-ring-width | .25rem | --bs-focus-ring-width | Focus rings of fields and .focus-ring |
--felt-focus-ring-x | 0 | .focus-ring: horizontal offset | |
--felt-focus-ring-y | 0 | .focus-ring: vertical offset | |
--felt-focus-ring-blur | 0 | .focus-ring: blur |
Type#
| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-font | system-ui, -apple-system, "Segoe UI", Roboto, sans-serif | --bs-body-font-family--bs-font-sans-serif | Body font |
--felt-font-heading | var(--felt-font) | Headings | |
--felt-font-mono | ui-monospace, SFMono-Regular, Menlo, Consolas, monospace | --bs-font-monospace | Code |
--felt-body-font-size | 1rem | --bs-body-font-size | Body text |
--felt-body-font-weight | 400 | --bs-body-font-weight | Body text |
--felt-body-line-height | 1.5 | --bs-body-line-height | Body text |
--felt-heading-color | inherit | --bs-heading-color | Headings |
--felt-body-text-align | start | Body text |
Spacing, radius and shadows#
| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-space-1 | .25rem | Spacer 1, the same scale as the spacing utilities | |
--felt-space-2 | .5rem | Spacer 2, the same scale as the spacing utilities | |
--felt-space-3 | 1rem | Spacer 3, the same scale as the spacing utilities | |
--felt-space-4 | 1.5rem | Spacer 4, the same scale as the spacing utilities | |
--felt-space-5 | 3rem | Spacer 5, the same scale as the spacing utilities | |
--felt-container-max | 1080px | Width of .container | |
--felt-breakpoint-xs | 0 | --bs-breakpoint-xs | Breakpoint xs (for scripts; media queries can't read it) |
--felt-breakpoint-sm | 576px | --bs-breakpoint-sm | Breakpoint sm (for scripts; media queries can't read it) |
--felt-breakpoint-md | 768px | --bs-breakpoint-md | Breakpoint md (for scripts; media queries can't read it) |
--felt-breakpoint-lg | 992px | --bs-breakpoint-lg | Breakpoint lg (for scripts; media queries can't read it) |
--felt-breakpoint-xl | 1200px | --bs-breakpoint-xl | Breakpoint xl (for scripts; media queries can't read it) |
--felt-breakpoint-xxl | 1400px | --bs-breakpoint-xxl | Breakpoint xxl (for scripts; media queries can't read it) |
--felt-radius-sm | 6pxfelt 5px | --bs-border-radius-sm | Corner radius sm |
--felt-radius | 10pxfelt 12px | --bs-border-radius | Corner radius |
--felt-radius-lg | 14pxfelt 18px | --bs-border-radius-lg | Corner radius lg |
--felt-radius-xl | 20pxfelt 24px | --bs-border-radius-xl | Corner radius xl |
--felt-radius-xxl | 32pxfelt 36px | --bs-border-radius-2xl--bs-border-radius-xxl | Corner radius xxl |
--felt-radius-pill | 999px | --bs-border-radius-pill | Pills |
--felt-shadow-sm | inset 0 1px 0 light-dark(transparent, rgb(255 255 255 / .04)), 0 1px 2px light-dark(rgb(16 24 40 / .06), rgb(0 0 0 / .3)) | --bs-box-shadow-sm | Clean-look shadows, darker in dark mode |
--felt-shadow | inset 0 1px 0 light-dark(transparent, rgb(255 255 255 / .04)), 0 1px 3px light-dark(rgb(16 24 40 / .08), rgb(0 0 0 / .35)), 0 1px 2px light-dark(rgb(16 24 40 / .04), rgb(0 0 0 / .2)) | --bs-box-shadow | Clean-look shadow of cards |
--felt-shadow-lg | 0 12px 32px -8px light-dark(rgb(16 24 40 / .22), rgb(0 0 0 / .6)), 0 2px 6px light-dark(rgb(16 24 40 / .08), rgb(0 0 0 / .3)) | --bs-box-shadow-lg | Clean-look shadow of what floats: menus, modals, toasts |
Images#
| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-gradient | linear-gradient(180deg, rgb(255 255 255 / .15), rgb(255 255 255 / 0))felt var(--felt-texture), var(--felt-patch-dome) | --bs-gradient | .bg-gradient: a sheen from the top; on felt the felt keeps its texture and swells like a patch |
--felt-select-chevron | var(--_chevron-clean) dark var(--_chevron-clean-dark)felt var(--_chevron-felt) dark var(--_chevron-felt-dark) | --bs-form-select-bg-img | The select's arrow: an image, so one per look and colour mode |