# mCSS: full reference > mCSS is a modern CSS framework and component library for websites: real CSS, real markup, zero build step, built on native cascade layers. It is not a dependency; you copy the files into your project and own them. This file concatenates every docs and components page. A per-page index is at /llms.txt. # Getting Started > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/docs/start mCSS is both a CSS framework and a methodology. You need to first understand the methodology to use the framework correctly. There are 3 main parts to the methodology. 1. The file structure 1. The CSS syntax 1. The component architecture Once you've read through the basics below, the best way to understand how it all comes together is to have a look at the [source code][src]. (Video tutorial coming soon!) ## mCSS file structure
The file structure is based on [ITCSS][1], but with important differences detailed below. The basic idea is to organize your files in different [layers][layers] so that your CSS [rulesets][2] are organized from global low [specificity][3] to local high specificity. When done right, it takes care of all the common "shortcomings" of CSS such as specificity wars and cascading conflicts. mCSS implements this with **native [CSS cascade layers][cascade-layers]**: every framework file is imported into a named `@layer`, and the layer order (not the import order, and not specificity) decides who wins. Anything you write *outside* the layers beats the framework by default, so mCSS always gets out of your way. The only exception is [helper classes][helpers], which use `!important` so they can override anything, including your own CSS. Below is an overview of each layer. The full documentation of most layers is available from the sidebar. This is how mCSS is organized. ([Github source][4].) ```css @layer settings, base, elements, global, atoms, components, pages, helpers; /* Build-time only (media queries + mixins definitions) */ @import url(./settings.media-queries.css); @import url(./settings.mixins.css); @import url(./settings.tokens.css) layer(settings); @import url(./settings.theme.default.css) layer(settings); @import url(./base.reset.css) layer(base); @import url(./elements.sectioning.css) layer(elements); @import url(./elements.text.css) layer(elements); /* etc. */ @import url(./global.grid.css) layer(global); @import url(./global.wrap.css) layer(global); /* etc. */ @import url(./atom.button.css) layer(atoms); /* etc. */ @import url(./component.notice.css) layer(components); /* etc. */ @import url(./help.spacing.css) layer(helpers); /* etc. */ /* Your site's own CSS imports UNLAYERED, after the framework. Its normal declarations win over every mCSS layer without fighting specificity. One exception: helpers are !important and beat unlayered CSS too. */ @import url(./site/myComponent.css); ``` [cascade-layers]: https://developer.mozilla.org/en-US/docs/Web/CSS/@layer The easiest ways to use mCSS in your own project: - **Drop-in file**: grab [`dist/mcss.css`][dist-css] (or [`dist/mcss.min.css`][dist-min]), the whole framework in one file, no build step needed. - **Individual files**: every framework file is also available pre-processed in [`dist/css/`][dist-dir] (with [`dist/css/mcss.css`][dist-index] as an `@import` index), so you can copy just the layers you need. - **Source files**: copy [`src/styles/framework/`][framework-src] if you run PostCSS yourself (the source uses `@custom-media`, which needs [postcss-preset-env][7]). Run `npm run build:css` in the repo to produce `dist/` from source. [dist-css]: https://github.com/minimaldesign/mCSS/blob/main/dist/mcss.css [dist-min]: https://github.com/minimaldesign/mCSS/blob/main/dist/mcss.min.css [dist-dir]: https://github.com/minimaldesign/mCSS/tree/main/dist/css [dist-index]: https://github.com/minimaldesign/mCSS/blob/main/dist/css/mcss.css [framework-src]: https://github.com/minimaldesign/mCSS/tree/main/src/styles/framework ### Settings Settings are where all custom properties are set. - [Tokens][5] is where you set default values for sizes, font stacks, colors, transitions, etc. See [the docs][5] for all the values available by default. - [Media queries][6] include responsive sizes, as well as user preferences like color schemes, reduced motion, etc. See [media queries docs][6]. - **Mixins** is optional. It is not used in other parts of mCSS by default but can be useful to streamline your own components' code. It requires a [PostCSS plugin][7] to work. - [Themes][themes] is an abstraction level to stadardize common values accross elements and components. For instance, you could use `--light-border-color` throughout your components instead of the lower level token `--base-200`. ### Base - Simple reset/normalize. ### HTML Elements The default styling of all HTML elements, without classes. - **Sectioning:** `header`, `footer`, etc. - **Text:** `a`, `p`, etc. - **Quotes:** adds the correct quotes depending on language. - **Media:** `img`,`video`, etc. - **Table:** `table`, `th`, etc. - **Form:** `input`, `button`, etc. - **Interactive:** `dialog`, `details`. ### Global Global styles inlcluded out of the box: - A responsive [grid system][grid]. - A full feature [wrapper][wrap]. - Common global site [layouts][layout]. - [Typography][prose], via the `.prose` class, for long form text, like articles, etc. - [Accessibility][a11y] (A11Y) specific classes. - Basic `@keyframes` animations (e.g., fade in/out) ### Atoms Atoms are the smallest explicit styling units in mCSS, applying CSS classes to individual HTML elements without needing a dedicated HTML/Astro component. For example, the `.button` atom can style a `

### Meter ```html 2 out of 10 5 out of 10 8 out of 10 ```

2 out of 10

5 out of 10

8 out of 10

### Progress

70%

## Media
| File name | Source | | -------------------- | ------------------ | | `elements.media.css` | [Github][srcMedia] | [srcMedia]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/elements.media.css
  • Plain `` element Saxophonist playing in Central Park
  • `
    ` element with `` element
    Saxophonist playing in Central Park
  • `
    ` element with `` and `
    ` elements
    Saxophonist playing in Central Park
    Here is a caption for this image.
  • `
    ` element with a `` element
    Saxophonist playing in Central Park
### Audio
### Video
### Canvas canvas
### Inline Frame
### Inline SVG ## Interactive
| File name | Source | | -------------------- | ------------------ | | `elements.interactive.css` | [Github][srcInteractive] | [srcInteractive]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/elements.interactive.css ### Details & Summary
Expand for details

Lorem ipsum dolor sit amet consectetur adipisicing elit. Cum, odio! Odio natus ullam ad quaerat, eaque necessitatibus, aliquid distinctio similique voluptatibus dicta consequuntur animi. Quaerat facilis quidem unde eos! Ipsa.

### Dialog

A random quote you might enjoy…

If you want to awaken all of humanity, then awaken all of yourself. If you want to eliminate the suffering of the world, then eliminate all that is negative in yourself. Truly the greatest gift you have to give is that of your own self-transformation.

--- # Global Styles > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/docs/global ## Grid
| File name | Source | | ----------------- | ----------------- | | `global.grid.css` | [Github][srcGrid] |
[srcGrid]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/global.grid.css The grid system is extremely easy to use, light weight, and very flexible. It uses the [CSS grid property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid) under the hood, but it lets you set up your layouts directly into your HTML. The implementation is heavily inspired by [Raster](https://github.com/rsms/raster). ### Syntax It's composed of 2 classes: `.grid` for the container, and `.grid_item` for each grid item. The default grid gap is defined as a custom property in the [default theme](/docs/themes) and is responsive: `16px` (`--sm1`) on small screens, stepping up to `24px` (`--sm3`) at the `--md` breakpoint (768px). You can override `--grid-column-gap` and `--grid-row-gap` globally in your own theme, or on a specific `.grid` element. A `grid-flush` modifier is available if you don't want any gap. Because `.grid` reads its gaps from those two custom properties, overriding a specific grid is just a matter of setting them on the element. Add a class of your own: ```css .photoWall { --grid-column-gap: var(--xs2); --grid-row-gap: var(--xs2); } ``` ```html
    ...
``` You define the amount of columns of your grid with a custom `col` attribute and the position/width of your grid_items with the custom `span` attribute. The `span` property syntax follows these 5 patterns: - `row`: the grid_item spans a full row - `3`: the grid_item start in the next column and spans 3 columns. - `3-5`: the grid_item starts in column 3 and ends in column 5. - `3+5`: the grid_item starts in column 3 and spans for 5 columns. - `3..`: the grid_item starts in column 3 and spans the remainder of rows. Both the `col` and `span` attributes have responsive versions, which use [the "mobile first" approach][1] of the `--*-n-above` media queries. The available tiers are **`-md`, `-lg`, and `-xl`** (`col-md`, `span-lg`, etc.); other suffixes like `col-sm` or `col-xxl` don't exist and are silently ignored. Grids support up to 24 columns. (The file is generated by `src/tools/generate.global.grid.cjs`; add a tier there if you need one.) [1]: /docs/media-queries#recommended-responsive-setup The custom attribute will not validate. If this is important to you, you'll need to change the attributes to `data-col` and `data-span` in both the CSS and HTML. I personally prefer to use shorter, more legible attributes. Check this thread on Github if you'd like to read more than you've ever wanted to know about [custom attributes and validation](https://github.com/whatwg/html/issues/2271). ### Examples #### Different types of spans 9 colum grid, with all types of spans.
2
4-5
6..
2-3
5..
2+3
6+2
row
4+2
```html
2
4-5
6..
2-3
5..
2+3
6+2
row
4+2
``` #### Responsive grid The grid layout follows a "mobile first" approach using `--*-n-above` media queries. The following example goes from 1 → 4 → 9 → 12 columns. (Resize window to see it in action.)
1
2
3
4
5
6
7
8
9
10
11
12
```html
[…]
``` ## Wrap
| File name | Source | | ----------------- | ----------------- | | `global.wrap.css` | [Github][srcWrap] |
[srcWrap]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/global.wrap.css The `.wrap` global class is a simple content wrapper that will center your content on the page and add some left/right padding on small viewports. The default `.wrap_content` has a width of `minmax(200px, 70ch)` by default (see below to customize) and there is a modifier `.wrap_content-fullBleed` that will extend to the full size of the viewport. See [demo](/demos/wrap). ### Syntax ```html
``` ### Settings You can customize 3 diffent sizes of left/right padding for responsive designs as well as the width of your content. The values below are set in the default theme.
| token | value | Description | | ----------------- | --------------------- | -------------------------------- | | `wrap-spacing` | `var(--sm1)` | default left/right padding | | `wrap-md-spacing` | `var(--sm3)` | left/right padding tablet and up | | `wrap-lg-spacing` | `0` | left/right padding laptop and up | | `wrap-width` | `minmax(200px, 70ch)` | 200px minimum, 70ch maximum |
- More info on [themes](/docs/themes). - More info on [responsive setup](/docs/media-queries#recommended-responsive-setup). ## Layouts
| File name | Source | | ------------------- | ------------------- | | `global.layout.css` | [Github][srcLayout] |
[srcLayout]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/global.layout.css This is where your global layouts should go. It's probably too project specific for mCSS to ship with really useful default layouts. But this will change as more [components](/components/start) become available. The layouts in this file are specific to mcss.dev docs and blog sections. They're not built as templates to use in your own projects but rather as examples of how to set it up. ## Prose
| File name | Source | | ------------------ | ------------------ | | `global.prose.css` | [Github][srcProse] |
[srcProse]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/global.prose.css The global `.prose` class can be used anywhere you need basic typography for long form text, like articles, blog posts, etc. It make spacing between paragraphs, lists, tables, etc. consistant. This spacing can be modified in your [theme](/docs/theme) via the `--prose-spacing` token. The `.prose` class also adds extra styling for `ol`, `ul`, and `code` elements. ## Accessibility
| File name | Source | | ----------------- | ----------------- | | `global.a11y.css` | [Github][srcA11y] |
[srcA11y]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/global.a11y.css This is where accessibility specific classes go. Currently a WIP as [components are being created](/components/start). ## Animation
| File name | Source | | ---------------------- | ---------------------- | | `global.animation.css` | [Github][srcAnimation] |
[srcAnimation]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/global.animation.css Basic fade in/out animations with flexible start/end opacity values. (More info about [forwards](/blog/css-animation-fill-modes)) ```css .element { opacity: 0.8; animation: fadeToTransparent 1s forwards; } ``` --- # Helpers > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/docs/helpers Helpers are classes for very targeted "one-off" local overrides. Every helper declaration uses `!important`, and because they live in an mCSS [cascade layer](/docs/start#mcss-file-structure), that beats everything: all framework layers, your own unlayered CSS, even normal inline styles. Think of a helper as inline styling for a single element. That power is exactly why they should be used as little as possible, but they're useful for things like: - Designer's request to "make an exception" - Quick fix until refactor - Temporary test/design Let's say the request is: _"This component just doesn't look right in that context, can we just increase the top and bottom padding?"_ You would use the spacing helper this way: ```html

Content goes here.

``` Using helpers is optional and mCSS will work just fine without them. None of the mCSS components rely on them. If you do use them in your project, it's recommended to use [PurgeCSS](https://purgecss.com/getting-started.html) to keep your CSS size to a minimum. For Astro users, the [astro-purgecss integration](https://github.com/codiume/orbit/tree/main/packages/astro-purgecss) does everything for you out of the box once you install it. Below is a list of all the available helpers. mCSS doesn't include every single CSS property like utility classes frameworks do. It only includes the ones you actually need in those "one-off" situations. I've never needed more than that, but I'm open to add anything that would be useful. Just [open an issue on Github](https://github.com/minimaldesign/mCSS/issues) with your use case and I'll add it in. ## Spacing | File name | Source | | ------------------ | -------------------- | | `help.spacing.css` | [Github][srcSpacing] | [srcSpacing]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/help.spacing.css ### width, height, margin, and padding You can combine these properties with any [dimension token](/docs/token#dimension) as well as `0`: | CSS property | Class prefix | | ---------------- | ------------ | | `width` | `w` | | `height` | `h` | | `margin` | `m` | | `margin-top` | `mt` | | `margin-bottom` | `mb` | | `margin-left` | `ml` | | `margin-right` | `mr` | | `padding` | `p` | | `padding-top` | `pt` | | `padding-bottom` | `pb` | | `padding-left` | `pl` | | `padding-right` | `pr` | #### Examples | Class | Value | | -------- | --------------------------- | | `w-lg1` | `width: var(--lg1)` | | `ml-0` | `margin-left: 0` | | `mb-sm1` | `margin-bottom: var(--sm1)` | ```html
A component with an extra bottom margin of 48px.
A component with an extra padding of 28px.
``` ## Colors | File name | Source | | ----------------- | ------------------- | | `help.colors.css` | [Github][srcColors] | [srcColors]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/help.colors.css ### color, background-color, and border-color You can combine this properties with any [color token](/docs/tokens#color): | CSS property | Class prefix | | ------------------ | ------------ | | `color` | `c` | | `background-color` | `bgc` | | `border-color` | `bdc` | #### Examples
| Class | Value | | --------------- | ----------------------------------- | | `bgc-base-200` | `background-color: var(--base-200)` | | `bdc-yes-500` | `border-color: var(--yes-500)` | | `c-primary-500` | `color: var(--primary-500)` |

A block with custom colors.

```html

A block with custom colors.

``` ## Layout | File name | Source | | ----------------- | ------------------- | | `help.layout.css` | [Github][srcLayout] | [srcLayout]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/help.layout.css ### overflow
| CSS property | CSS value | Class | Short class | | ------------ | --------- | --------------------- | --------------- | | `overflow` | `auto` | `.overflow-auto` | `.of-auto` | | `overflow` | `hidden` | `.overflow-hidden` | `.of-hidden` | | `overflow` | `clip` | `.overflow-clip` | `.of-clip` | | `overflow` | `visible` | `.overflow-visible` | `.of-visible` | | `overflow` | `scroll` | `.overflow-scroll` | `.of-scroll` | | `overflow-x` | `auto` | `.overflow-x-auto` | `.of-x-auto` | | `overflow-y` | `auto` | `.overflow-y-auto` | `.of-y-auto` | | `overflow-x` | `hidden` | `.overflow-x-hidden` | `.of-x-hidden` | | `overflow-y` | `hidden` | `.overflow-y-hidden` | `.of-y-hidden` | | `overflow-x` | `clip` | `.overflow-x-clip` | `.of-x-clip` | | `overflow-y` | `clip` | `.overflow-y-clip` | `.of-y-clip` | | `overflow-x` | `visible` | `.overflow-x-visible` | `.of-x-visible` | | `overflow-y` | `visible` | `.overflow-y-visible` | `.of-y-visible` | | `overflow-x` | `scroll` | `.overflow-x-scroll` | `.of-x-scroll` | | `overflow-y` | `scroll` | `.overflow-y-scroll` | `.of-y-scroll` |
### position Helper classes for the `position` property.
| CSS value | Class | | ---------- | -------------------- | | `static` | `.position-static` | | `fixed` | `.position-fixed` | | `absolute` | `.position-absolute` | | `relative` | `.position-relative` | | `sticky` | `.position-sticky` |
### visibility Helper classes for the `visibility` property.
| CSS value | Class | | ---------- | ---------------------- | | `visible` | `.visibility-visible` | | `hidden` | `.visibility-hidden` | | `collapse` | `.visibility-collapse` |
### z-index Helper classes for the `z-index` property. See also the [z-index token docs](docs/tokens#z-index).
| Custom Property | CSS Value | Class | | --------------- | ----------- | ----------- | | `--z-bottom` | -1000000000 | `.z-bottom` | | `--z-0` | 0 | `.z-0` | | `--z-1` | 10 | `.z-1` | | `--z-2` | 20 | `.z-2` | | `--z-3` | 30 | `.z-3` | | `--z-4` | 40 | `.z-4` | | `--z-5` | 50 | `.z-5` | | `--z-top` | 1000000000 | `.z-top` |
## Aspect ratios | File name | Source | | ----------------- | ------------------- | | `help.ratios.css` | [Github][srcRatios] | [srcRatios]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/help.ratios.css
| Custom Property | CSS Value | Class | | ----------------- | --------- | ---------------- | | `--ar-square` | 1 | `.ar-square` | | `--ar-landscape` | 4/3 | `.ar-landscape` | | `--ar-portrait` | 3/4 | `.ar-portrait` | | `--ar-widescreen` | 16/9 | `.ar-widescreen` | | `--ar-golden` | 1.618/1 | `.ar-golden` |
## Opacity | File name | Source | | ------------------ | -------------------- | | `help.opacity.css` | [Github][srcOpacity] | [srcOpacity]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/help.opacity.css | Custom Property | CSS Value | Class | | --------------- | --------- | ------ | | `--o-0` | 0 | `.o-0` | | `--o-1` | 0.2 | `.o-1` | | `--o-2` | 0.4 | `.o-2` | | `--o-3` | 0.6 | `.o-3` | | `--o-4` | 0.8 | `.o-4` | | `--o-5` | 1 | `.o-5` | ## Typography | File name | Source | | --------------------- | ----------------------- | | `help.typography.css` | [Github][srcTypography] | [srcTypography]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/help.typography.css ### font-family See the [font stack tokens](/docs/tokens#font-stack) for details.
| Custom Property | Class | | --------------- | --------------- | | `--text` | `.font-text` | | `--display` | `.font-display` | | `--mono` | `.font-mono` |
### font-style | CSS value | Class | | --------- | -------------- | | `italic` | `.font-italic` | | `normal` | `.font-normal` | ### font-weight See the [font weight tokens](/docs/tokens#font-weight) for details.
| Custom Property | Class | | --------------- | ------------------- | | `--extra-light` | `.font-extra-light` | | `--light` | `.font-light` | | `--book` | `.font-book` | | `--semi-bold` | `.font-semi-bold` | | `--bold` | `.font-bold` | | `--black` | `.font-black` |
### font-size See the [font size tokens](/docs/tokens#font-size) for details. | Custom Property | Class | | --------------- | ------------- | | `--text-xs` | `.text-xs` | | `--text-sm` | `.text-sm` | | `--text-md` | `.text-md` | | `--text-lg` | `.text-lg` | | `--text-xl` | `.text-xl` | | `--display-sm` | `.display-sm` | | `--display-md` | `.display-md` | | `--display-lg` | `.display-lg` | | `--display-xl` | `.display-xl` | ### line-height See the [line height tokens](/docs/tokens#line-height) for details. | Custom Property | Class | | --------------- | -------------- | | `--leading-xs` | `.leading-xs` | | `--leading-sm` | `.leading-sm` | | `--leading-md` | `.leading-md` | | `--leading-lg` | `.leading-lg` | | `--leading-xl` | `.leading-xl` | | `--leading-xxl` | `.leading-xxl` | ### text-align | CSS value | Class | | --------- | --------------- | | `left` | `.text-left` | | `center` | `.text-center` | | `right` | `.text-right` | | `justify` | `.text-justify` | | `start` | `.text-start` | | `end` | `.text-end` | ### text-transform | CSS value | Class | | ------------ | ------------------ | | `uppercase` | `.text-uppercase` | | `lowercase` | `.text-lowercase` | | `capitalize` | `.text-capitalize` | --- # AI Agents > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/docs/ai mCSS is built to be easy for AI coding agents (Claude Code, Cursor, Copilot, and friends) to work with. The docs are available in machine-readable form, and this page includes a rules block you can paste into your project's agent instructions so generated markup is idiomatic mCSS instead of a plausible-looking guess. ## Machine-readable docs Three things exist specifically for agents: - **[/llms.txt](/llms.txt)**: an index of every docs and components page with one-line descriptions, following the [llms.txt](https://llmstxt.org) convention. Most agent tooling checks for this automatically. - **[/llms-full.txt](/llms-full.txt)**: the entire reference (docs and all components) concatenated into a single markdown file. Point an agent here when it needs the whole framework in one fetch. - **Markdown twins**: every docs and components page is also served as plain markdown at the same URL with `.md` appended. For example, [/docs/tokens.md](/docs/tokens.md) or [/components/card.md](/components/card.md). These are a fraction of the size of the HTML pages and contain no site chrome. If you tell your agent one thing, tell it this: fetch the `.md` URLs, not the HTML. ## Add mCSS rules to your agent instructions Paste the block below into your project's `CLAUDE.md`, `AGENTS.md`, or equivalent. It compresses the conventions that matter most when writing mCSS markup and CSS on top of it. ````md ## mCSS conventions This project uses mCSS (https://mcss.dev), a copy-it-you-own-it CSS framework. The framework files live in this repo, not in node_modules; treat them as project code, not as an immutable dependency. Full reference: https://mcss.dev/llms-full.txt Per-page markdown docs: append `.md` to any docs or components URL (e.g. https://mcss.dev/components/card.md). ### Class naming (BEM-like, different separators) - Block: `.componentName` (camelCase for multi-word names) - Element: `.componentName_element` (single underscore; chains may nest as deep as the block's own structure needs) - Modifier: `.componentName-modifier` (single hyphen), for build-time variants - State: `.is-*` (`.is-active`, `.is-open`), only for things that change at runtime, always scoped inside the block - Prefer styling ARIA attributes over inventing state classes when one exists: `[aria-current]`, `[aria-expanded="true"]`, `[aria-disabled="true"]` ### Never couple classes from different components A selector must only contain classes from its own block. Never write a selector that reaches into another component (`.myPage .card_title` is banned). To style a component from outside: mix your own class onto its root in the markup and style that, or set the component's theme tokens (`--card-*`, `--bt-*`, ...) on your own hook class. Bare HTML tags, `.is-*`, and ARIA selectors are fine inside your own block. ### Customization (you own the files) - Customize by editing the framework files directly, tokens first: change `settings.tokens.css` values (colors, type, spacing) before touching component CSS. - Component tokens follow `--component-part-property`, longhand, kebab-case: `--bt-background-color-hover`, `--notice-border-width`. No abbreviations. - Prefer semantic feedback tokens (`--success-*`, `--danger-*`, `--warning-*`). ### Cascade model (native @layer) - The framework lives in cascade layers; your unlayered project CSS beats all of it by design. Never add `!important` to win against the framework. - The exception: helper classes (`help.*` files, e.g. spacing/color/typography utilities) carry `!important` and beat everything, like inline styles. - Never use `transition: all`; list the properties that actually animate. ```` ## MCP and tooling There is no mCSS MCP server yet. For now, `llms-full.txt` plus the rules block above is the recommended setup. If your agent supports fetching URLs at runtime, the markdown twins are the cheapest way to pull a single component's markup reference into context. --- # Getting started > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/start The mCSS component library is entirely built with the [mCSS framework](/docs/start), and you **own the code**: instead of installing a package, you copy the pieces you want into your project and edit them like anything else you wrote. Every component's docs page has a "What to copy" table listing exactly which files, icons, and theme tokens it needs. Each component comes in two flavors: - **Plain HTML + CSS.** Copy the `component.*.css` file (or grab the compiled version from [`dist/css/`](https://github.com/minimaldesign/mCSS/tree/main/dist/css)) and use the documented markup. Works with any framework, or none. - **Astro.** Copy the `.astro` file(s) for typed props, slots, and sensible accessibility defaults out of the box. Components stay deliberately close to the platform: almost everything here is zero-JavaScript (the exceptions are the [header](/components/header)'s mobile menu and the dismissible [banner](/components/banner), a few lines each). Styling lives in [cascade layers](/docs/start), so your own unlayered CSS always wins, and every visual knob is a documented `--component-*` token in the [default theme](/docs/themes). Spotted a bug, or built something worth sharing? [Issues and discussions](https://github.com/minimaldesign/mCSS/issues) are open. --- # Badge > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/badge The `.badge` atom is a small label for statuses, categories, and "new" markers. Pure CSS; there is no Astro component because a `` with a class is already the whole API.

defaultprimarysuccessdangerwarning

| File | Description | Source | | ---------------------------------- | ------------------------------ | ----------- | | `atom.badge.css` | All badge styles | [Github][1] | | `--badge-*` block in default theme | Theme tokens (see table below) | [Github][2] |
[1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/atom.badge.css [2]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/settings.theme.default.css ## Playground {label}
'} baseClasses="badge" controls={[ { heading: "Variation", items: [ { type: "select", name: "color", label: "Color", default: "", options: [ { label: "Default", value: "" }, { label: "Primary", value: "badge-primary" }, { label: "Success", value: "badge-success" }, { label: "Danger", value: "badge-danger" }, { label: "Warning", value: "badge-warning" }, ]}, ]}, { heading: "Content", items: [ { type: "text", name: "label", label: "Label", default: "new" }, ]}, ]} /> ## HTML ```html default shipped ``` ### Available modifiers
| Class | Description | | ---------------------------- | --------------------------------- | | `.badge` | Default style. Neutral colors. | | `.badge` + `.badge-primary` | Primary colors. | | `.badge` + `.badge-success` | Positive feedback. Greens. | | `.badge` + `.badge-danger` | Negative feedback. Reds. | | `.badge` + `.badge-warning` | Warning. Oranges. |
One-off colors work like every other variant in mCSS: override the local custom property. ```html custom ``` ### Custom properties The following custom properties are available in the [default theme](/docs/themes):
| Property | Description | | ------------------------------------ | ------------------------------ | | `--badge-font-size` | Font size. | | `--badge-border-radius` | Border radius. | | `--badge-color` | Default text color. | | `--badge-background-color` | Default background color. | | `--badge-primary-color` | Primary variant text color. | | `--badge-primary-background-color` | Primary variant background. | | `--badge-success-color` | Success variant text color. | | `--badge-success-background-color` | Success variant background. | | `--badge-danger-color` | Danger variant text color. | | `--badge-danger-background-color` | Danger variant background. | | `--badge-warning-color` | Warning variant text color. | | `--badge-warning-background-color` | Warning variant background. |
--- # Button > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/button The `button` [atom](/docs/start#atoms) uses the `.bt` class (canonical; `.button` is kept as an alias). Apply it to `
| File | Description | Source | | ----------------- | ----------- | ----------- | | `atom.button.css` | All button styles (`.button` or `.bt`) | [Github][1] | [1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/atom.button.css
## Playground {icon}{label}'} baseClasses="bt" snippets={{ icon: { preview: mail, code: "[…] " } }} controls={[ { heading: "Variation", items: [ { type: "select", name: "size", label: "Size", default: "", options: [ { label: "Default", value: "" }, { label: "Medium", value: "bt-md" }, { label: "Large", value: "bt-lg" }, ]}, { type: "select", name: "color", label: "Color", default: "", options: [ { label: "Default", value: "" }, { label: "Primary", value: "bt-primary" }, { label: "Yes", value: "bt-yes" }, { label: "Maybe", value: "bt-maybe" }, { label: "No", value: "bt-no" }, { label: "White", value: "bt-white", previewSurface: "dark" }, { label: "White outline", value: "bt-outline-white", previewSurface: "dark" }, ]}, ]}, { heading: "Modifiers", items: [ { type: "checkbox", name: "outline", label: "Outline", value: "bt-outline", default: false }, { type: "checkbox", name: "text", label: "Text button", value: "bt-text", default: false }, { type: "checkbox", name: "icon", label: "Icon", snippet: "icon", default: false }, { type: "checkbox", name: "tightIcon", label: "Tight icon", value: "bt-tightIcon", default: false }, ]}, { heading: "Content", items: [ { type: "text", name: "label", label: "Label", default: "Button" }, ]}, { heading: "State", items: [ { type: "checkbox", name: "disabled", label: "Disabled", attr: "disabled", default: false }, ]}, ]} /> ## HTML You can combine modifiers in any way you like (see [examples](#examples)). The `.bt-outline-white` and `.bt-white` (solid, primary text) are special case buttons useful for dark/image/gradient backgrounds such as [Heroes](/components/hero) and don't change between light/dark themes.
### Custom properties The following custom properties are available in the [default theme](/docs/themes):
| Property | Description | | ------------------------------------- | --------------------------------- | | `--bt-font-size` | Font size. | | `--bt-font-size-lg` | Large font size. | | `--bt-font-weight` | Font weight. | | `--bt-color` | Text color. | | `--bt-color-hover` | Text color (hover). | | `--bt-background-color` | Background color. | | `--bt-background-color-hover` | Background color (hover). | | `--bt-border-color` | Border color. | | `--bt-border-width` | Border width. | | `--bt-border-radius` | Border radius. | | `--bt-border-radius-lg` | Large border radius. | | `--bt-outline-color-hover` | Outline text color (hover). | | `--bt-outline-background-color-hover` | Outline background color (hover). | | `--bt-outline-border-color` | Outline border color. | | `--bt-primary-color` | Primary text color. | | `--bt-primary-color-hover` | Primary text color (hover). | | `--bt-primary-background-color` | Primary background color. | | `--bt-primary-background-color-hover` | Primary background color (hover). | | `--bt-primary-border-color` | Primary border color. | | `--bt-primary-border-color-hover` | Primary border color (hover). |
### Examples
  • This is a Link ```html This is a Link ```
  • ```html ```
  • ```html ```
--- # Toggle > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/toggle The `toggle` [atom](/docs/start#atoms) uses the `.toggle` class on `` elements of the type `checkbox`.
| File | Description | Source | | ----------------- | ----------- | ----------- | | `atom.toggle.css` | All toggle styles (`.toggle`) | [Github][1] |
[1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/atom.toggle.css ## Playground '} baseClasses="toggle" controls={[ { heading: "State", items: [ { type: "checkbox", name: "checked", label: "Checked", attr: "checked", default: true }, { type: "checkbox", name: "disabled", label: "Disabled", attr: "disabled", default: false }, ]}, ]} /> ## HTML
  • ```html ```
--- # Avatar > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/avatar The `.avatar` component is a visual representation of a user. It shows the user's initials or an image thumbnail. Its default size is 56px. (See the [HTML](#html) section below for all options.) SR
| File | Description | Source | | ---------------------- | ----------- | ----------- | | `component.avatar.css` | All avatar styles (`.avatar`) | [Github][1] |
[1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/component.avatar.css ## Playground
{content}
`} baseClasses="avatar" snippets={{ initials: { preview: "SR", code: "SR" }, image: { preview: `Sonny Rollins`, code: `Sonny Rollins`, }, }} controls={[ { heading: "Variation", items: [ { type: "select", name: "size", label: "Size", default: "", options: [ { label: "Default", value: "" }, { label: "Small", value: "avatar-sm" }, { label: "Medium", value: "avatar-md" }, { label: "Large", value: "avatar-lg" }, { label: "Extra large", value: "avatar-xl" }, ]}, ]}, { heading: "State", items: [ { type: "select", name: "status", label: "Status", default: "", options: [ { label: "None", value: "" }, { label: "Online", value: "is-online" }, { label: "Offline", value: "is-offline" }, ]}, ]}, { heading: "Content", items: [ { type: "select", name: "content", label: "Show", snippet: "content", default: "initials", options: [ { label: "Initials", value: "initials", class: "", snippet: "initials" }, { label: "Image", value: "image", class: "", snippet: "image" }, ]}, ]}, ]} /> ## HTML ### Available modifiers
| Available modifiers | Description | | ----------------------------- | -------------------------- | | `.avatar` | Default - 56px | | `.avatar` + `.avatar-sm` | Small - 24px | | `.avatar` + `.avatar-md` | Medium - 36px | | `.avatar` + `.avatar-lg` | Large - 80px | | `.avatar` + `.avatar-xl` | Extra large - 128px | | `.avatar` + `.is-online` | User is online - green dot | | `.avatar` + `.is-offline` | User is offline - grey dot |
### Custom properties The following custom properties are available in the [default theme](/docs/themes):
| Property | Color | | ----------------------------------- | --------------------------------- | | `--avatar-color` | Text color (when no image). | | `--avatar-background-color` | Background color (when no image). | | `--avatar-border-color` | Border color. | | `--avatar-border-width` | Border width. | | `--avatar-radius` | Radius. (`0` = square). | | `--avatar-status-dot-color-offline` | Status dot color: offline. | | `--avatar-status-dot-color-online` | Status dot color: online. |
## Astro component
| Prop | Type | Default | Description | | ------------ | --------- | --------- | ----------------------------------------------------------- | | `size` | `string` | undefined | `sm`, `md`, `lg`, `xl` ([px values](#html)) | | `imageSrc` | `string` | undefined | Optional image. | | `status` | `'online' \| 'offline'` | `undefined` | Shows a status dot (green online / grey offline) | | `class` | `string` | undefined | Additional CSS classes, useful for [helper classes](/docs/helpers). |
## Examples
  • ### Full name vs initials Sonny Rollins SR ```astro --- import Avatar from "../../components/Avatar.astro"; --- Sonny Rollins SR ``` The astro component can take initials or a full name and will output initials if an image is not provided. It will output the full name in the `alt` attribute if an image is provided.
  • ### Offline large avatar Sonny Rollins ```astro --- import Avatar from "../../components/Avatar.astro"; import imageSrc from "../../assets/images/sonny.png"; --- Sonny Rollins ```
### HTML examples
  • SR ```html
    SR
    ```
--- # Banner > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/banner The `.banner` component is the thin announcement bar at the very top of the page, optionally dismissible (remembered in `localStorage`).

mCSS v1 is out! Read the announcement

| File | Description | Source | | ----------------------------------- | ------------------------------ | ----------- | | `component.banner.css` | All banner styles | [Github][1] | | `Banner.astro` | The Astro component | [Github][2] | | `icons/x.svg` | Dismiss icon | [Github][3] | | `--banner-*` block in default theme | Theme tokens (see table below) | [Github][4] |
[1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/component.banner.css [2]: https://github.com/minimaldesign/mCSS/blob/main/src/components/Banner.astro [3]: https://github.com/minimaldesign/mCSS/tree/main/src/assets/icons [4]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/settings.theme.default.css ## Playground
`} baseClasses="section wrap" controls={[ { heading: "Variation", items: [ { type: "select", name: "variant", label: "Variant", default: "", options: [ { label: "Default", value: "" }, { label: "Filled", value: "section-filled" }, { label: "Primary", value: "section-primary" }, ]}, ]}, { heading: "Layout", items: [ { type: "checkbox", name: "wide", label: "Wide", value: "section-wide", default: false }, ]}, { heading: "Content", items: [ { type: "text", name: "eyebrow", label: "Eyebrow", default: "Why mCSS" }, { type: "text", name: "title", label: "Title", default: "Everything is a section" }, { type: "text", name: "lede", label: "Lede", default: "Stack a few of these and you have a landing page." }, ]}, ]} /> ## HTML ```html

Why mCSS

Everything is a section

Stack a few of these and you have a landing page.

``` ### Available modifiers
| Class | Description | | --------------------------------- | ------------------------------------------------------------------ | | `.section` | Default. Transparent background, `--section-spacing` vertical padding. | | `.section` + `.section-filled` | Subtle filled band. | | `.section` + `.section-primary` | Primary-colored band; text and links switch to the inverted colors. | | `.section` + `.section-wide` | Widens the content column to `--section-wide-width`. |
### Elements
| Class | Description | | ------------------ | ---------------------------------------------------------------- | | `.section_header` | Centered eyebrow/title/lede block. | | `.section_eyebrow` | Small uppercase kicker. | | `.section_title` | The `h2`. | | `.section_lede` | Intro paragraph. | | `.section_actions` | Centered, wrapping button row (see the closing-CTA recipe below). |
### Custom properties The following custom properties are available in the [default theme](/docs/themes):
| Property | Description | | ------------------------------------ | ---------------------------------------- | | `--section-spacing` | Vertical padding of the band. | | `--section-header-spacing` | Space between the header and content. | | `--section-wide-width` | Content column width of the wide preset. | | `--section-eyebrow-color` | Eyebrow text color. | | `--section-lede-color` | Lede text color. | | `--section-filled-background-color` | Background of the filled variant. | | `--section-primary-background-color` | Background of the primary variant. | | `--section-primary-text-color` | Text color on the primary variant. | | `--section-primary-link-color` | Link color on the primary variant. | | `--section-primary-link-color-hover` | Link hover color on the primary variant. | | `--section-primary-eyebrow-color` | Eyebrow color on the primary variant. | | `--section-primary-lede-color` | Lede color on the primary variant. |
## Astro component
| Prop | Type | Default | Description | | --------- | -------- | ----------- | ------------------------------------------------------------------- | | `eyebrow` | `string` | `undefined` | Small uppercase kicker above the title. | | `title` | `string` | `undefined` | The section's `h2`. | | `lede` | `string` | `undefined` | Intro paragraph under the title. | | `variant` | `string` | `undefined` | `filled`, `primary`. | | `width` | `string` | `undefined` | `wide`. | | `class` | `string` | `undefined` | Additional CSS classes, useful for [helper classes](/docs/helpers). |
Any other attribute is passed through to the root `
` element (handy for `id` anchors). The default slot is the section content. ## Examples
  • Text and links flip to the inverted palette.

    ```astro --- import Section from "../components/Section.astro"; ---

    Text and links flip to the inverted palette.

    ```
  • 1
    2
    3
    ```astro
    ```
  • The closing CTA every marketing page ends on is not a separate component; it is a Section with a `.section_actions` row:
    ```astro
    ```
--- # Social Media Links > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/socialmedia
The `.socialMedia` component consists of an unordered list of links to social media accounts and their corresponding icons.
| File | Description | Source | | --------------------------- | ----------- | ----------- | | `component.socialMedia.css` | All social links styles (`.socialMedia`) | [Github][1] |
[1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/component.socialMedia.css The following 4 sizes and 19 icons (18 social media platforms + 1 generic link icon) are available out of the box.
| Platform | Icon | | ----------- | -------------------------------------------- | | Unknown URL | | | Discord | | | Facebook | | | Github | | | Instagram | | | Linkedin | | | Pinterest | | | Reddit | | | Snapchat | | | Telegram | | | Tiktok | | | X | | | Youtube | | | Twitch | | | Odysee | | | Minds | | | Substack | | | Bitchute | | | Bastyon | |
## Playground
  • {x}
  • {github}
  • {youtube}
  • `} baseClasses="socialMedia" snippets={{ x: { preview: xIcon, code: "[…]" }, github: { preview: githubIcon, code: "[…]" }, youtube: { preview: youtubeIcon, code: "[…]" }, }} controls={[ { heading: "Variation", items: [ { type: "select", name: "size", label: "Size", default: "", options: [ { label: "Default", value: "" }, { label: "Medium", value: "socialMedia-md" }, { label: "Large", value: "socialMedia-lg" }, { label: "Extra large", value: "socialMedia-xl" }, ]}, ]}, ]} /> ## HTML
    | Available modifiers | Description | | ---------------------------------- | -------------- | | `.socialMedia` | Default - 24px | | `.socialMedia` + `.socialMedia-md` | 32px | | `.socialMedia` + `.socialMedia-lg` | 44px | | `.socialMedia` + `.socialMedia-xl` | 64px |
    When using the HTML component you'll need to include the SVG icons "manually." All the icons are [available on Github](https://github.com/minimaldesign/mCSS/tree/main/src/assets/icons). If you'd like to use different icons, [Lucide](https://lucide.dev/) is a great resource.
    ## Astro component
    The Astro component ([Github](https://github.com/minimaldesign/mCSS/blob/main/src/components/SocialMedia.astro)) takes 3 props:
    | Prop | Type | Default | Description | | ------------ | -------- | --------- | ----------------------------------------------------------- | | `urls` | `array` | `[]` | An array of urls, or `{ url, label }` objects to override the accessible label (e.g. `"mCSS on GitHub"`). | | `size` | `string` | undefined | `md`, `lg`, `xl`. | | `newTab` | `boolean` | `true` | Open links in a new tab. Set to `false` to opt out. | | `class` | `string` | undefined | Additional CSS classes, useful for [helper classes](/docs/helpers). |
    ## Examples
    • ```astro --- import SocialMedia from "../../components/SocialMedia.astro"; --- ```
    • ```astro --- import SocialMedia from "../../components/SocialMedia.astro"; --- ```
    ### HTML examples --- # Tags > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/tags
    The `.tags` component styles a list of tags. It supports both list and inline layouts, is accessible by default, and customizable via CSS custom properties.
    | File | Description | Source | | -------------------- | ----------- | ----------- | | `component.tags.css` | All tags styles (`.tags`) | [Github][1] |
    [1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/component.tags.css
    ## Playground
  • css
  • astro
  • basics
  • `} baseClasses="tags" controls={[ { heading: "Variation", items: [ { type: "select", name: "layout", label: "Layout", default: "", options: [ { label: "List", value: "" }, { label: "Inline", value: "tags-inline" }, ]}, ]}, ]} /> ## HTML ### Custom properties The following custom properties are available in the [default theme](/docs/themes): | Property | Description | | ------------------------------- | --------------------------- | | `--tags-padding` | Tag padding. | | `--tags-font-size` | Tag font size. | | `--tags-color` | Tag text color. | | `--tags-background-color` | Tag background color. | | `--tags-background-color-hover` | Tag hover background color. | | `--tags-radius` | Tag border radius. | ### Available modifiers
    | Modifier | Description | | -------------- | ---------------------------- | | `.tags` | Default style (list layout). | | `.tags-inline` | Inline layout using flex. |
    ## Astro component
    | Prop | Type | Default | Description | | ------------- | ---------- | ----------- | ----------------------------------------------------------- | | `tagList` | `string[]` | `[]` | Array of tag strings to display. | | `variant` | `string` | `inline` | Inline or list layout. | | `url` | `string` | `/blog/tags` | Base URL to prepend to each tag. | | `sort` | `boolean` | `false` | Sort tags alphabetically; input order is preserved by default. | | `class` | `string` | `undefined` | Additional CSS classes, useful for [helper classes](/docs/helpers). | | `ariaLabel` | `string` | `'Tags'` | Accessible label for the tag list. | | `data-testid` | `string` | `'tags'` | Test ID for testing purposes. |
    ## Examples
    • ### Astro example (frontmatter metadata) ```astro --- import Tags from '../components/Tags.astro'; const { frontmatter } = Astro.props; --- ```
    • ### HTML example (list layout) ```html ```
    --- # Testimonial > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/testimonial The `.testimonial` component is a quote with attribution: a `figure` wrapping mCSS's already-styled `blockquote`, plus an [Avatar](/components/avatar) byline. Pure HTML and CSS.

    We deleted four hundred lines of utility classes the week we switched. The cascade does the work now.

    | File | Description | Source | | --------------------------------------- | ------------------------------------- | ----------- | | `component.testimonial.css` | Layout + byline styles | [Github][1] | | `elements.text.css` | The `blockquote` styling (dependency) | [Github][2] | | `Testimonial.astro`, `Avatar.astro` | The Astro components | [Github][3] | | `--testimonial-role-color` in default theme | Theme token | [Github][4] |
    [1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/component.testimonial.css [2]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/elements.text.css [3]: https://github.com/minimaldesign/mCSS/tree/main/src/components [4]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/settings.theme.default.css ## Playground

    {quote}

    `} controls={[ { heading: "Content", items: [ { type: "text", name: "quote", label: "Quote", default: "We deleted four hundred lines of utility classes the week we switched." }, ]}, { heading: "Byline", items: [ { type: "text", name: "name", label: "Name", default: "Sonny Mueller" }, { type: "text", name: "role", label: "Role", default: "Design lead, Acme" }, { type: "text", name: "initials", label: "Initials", default: "SM" }, ]}, ]} /> ## HTML ```html

    We deleted four hundred lines of utility classes the week we switched.

    ``` ### Custom properties
    | Property | Description | | -------------------------- | ----------------- | | `--testimonial-role-color` | Role text color. |
    The quote itself is themed by the `blockquote` element styles. ## Astro component
    | Prop | Type | Default | Description | | ----------- | ------------------------- | ----------- | ------------------------------------------------ | | `name` | `string` | — | Who said it. Required (also feeds the Avatar initials when there is no photo). | | `role` | `string` | `undefined` | Title/company line. | | `avatarSrc` | `ImageMetadata \| string` | `undefined` | Photo for the Avatar. | | `class` | `string` | `undefined` | Additional CSS classes. |
    The default slot is the quote. ## Examples A wall of quotes is just testimonials on the [grid](/docs/global#grid):
    • The copy-paste model means I actually own my components.

      Readable class names. Imagine that.

      Shipped our marketing site in a weekend.

      ```astro --- import Testimonial from "../components/Testimonial.astro"; ---

      The copy-paste model means I actually own my components.

      ```
    --- # Table of Content > Part of mCSS (mcss.dev). Rendered page: https://mcss.dev/components/toc
    The `.toc` component is an "Astro only" client-side rendered component. It creates a table of content from the headings on the page it's on:
    By default, the TOC includes `H2`s and `H3`s (customizable via props) that have an ` id` attribute and links to them. It's possible to add multiple TOC on the same page, but this will duplicate Javascript and it's not recommended. If you do need to include more than one TOC, you'll need to add a unique `id` to each instance of the component.
    | File | Description | Source | | ------------------- | ----------- | ----------- | | `component.toc.css` | All TOC styles (`.toc`) | [Github][1] |
    [1]: https://github.com/minimaldesign/mCSS/blob/main/src/styles/framework/component.toc.css
    ## HTML This component's main functionality is to create a table of content via JavaScript. It just renders a nested `ul` and it's most useful as an Astro component. ### Custom properties The following custom properties are available in the [default theme](/docs/themes): | Property | Color | | ------------------- | ------------------------- | | `--toc-color` | Links color. | | `--toc-color-hover` | Links hover color. | | `--toc-spacing` | Links padding. | | `--toc-icon-size` | Icon size. | | `--toc-indentation` | Nested lists indentation. | ## Astro component
    | Prop | Type | Default | Description | | -------------- | --------- | ------------- | ----------------------------------------------------------- | | `id` | `string` | `toc` | Needed to add more than one TOC. | | `selector` | `string` | `main` | HTML element to scan for headings. | | `headings` | `array` | `['h2','h3']` | Heading levels to include. | | `baseUrl` | `string` | `''` | Optional URL to prepend `#id` with. | | `scrollOffset` | `integer` | `0` | Scroll position offset from the top.. | | `description` | `string` | `undefined` | Text above the TOC. | | `icon` | `string` | `''` | Optional inline SVG. (See example.) | | `class` | `string` | `undefined` | Additional CSS classes, useful for [helper classes](/docs/helpers). |
    ## Examples
    • ### TOC with only H2s ```astro --- import Toc from "../../components/Toc.astro"; --- ```
    • ### TOC with H2 — h4 and a ♥︎ icon #### A H4 just as an example ```astro --- import heart from "../../assets/icons/arrow-right-small.svg?raw"; import Toc from "../../components/Toc.astro"; --- ```