Setup and configuration
Use the package importer to resolve the public Sass entry.
Compile app.scss with sass --pkg-importer=node app.scss app.css.
@use "pkg:@expressivecss/expressive/scss" as expressive with (
$md-source: #6750a4,
$expressive-include-fonts: false
);
.notice {
@include expressive.typescale("body-large");
@include expressive.bp-up("expanded") { padding: 2rem; }
}
The main entry emits the stylesheet and forwards the shared abstracts. To use only functions
and mixins without emitting framework CSS, load
pkg:@expressivecss/expressive/scss/abstracts/index.
Those mixins still need the framework tokens in the consuming stylesheet.
Sass modules load once; configure a module on its first load.
Use pkg:@expressivecss/expressive/scss/custom to select
$components and $utilities. Each is an ordered list of partial names.
null loads the full group; () loads none. Tokens and base styles always load.
Follow the smaller-build recipes for supporting partials.
| Configuration | Default and purpose |
|---|---|
$md-source | #c6a0f6, the theme seed. Runtime theming uses --md-source. |
$expressive-include-fonts, $expressive-font-path | true and "../fonts". Disable bundled font faces when supplying your own; otherwise keep the font files at the emitted URLs. |
$expressive-glass, $expressive-glass-blur, $expressive-glass-opacity | false, 16px and 72%. Opacity must be a percentage. See Frosted glass for runtime switches. |
$gutter-width, $element-top-margin, $element-bottom-margin | 1.5rem, one third of the gutter and two thirds of the gutter. Shared layout spacing. |
$root-font-size, $font-stack, $text-color, $link-color | 16px, the plain/fallback typeface tokens, on-surface and primary. Prefer runtime tokens for theme-dependent values. |
$flow-text-min, $flow-text-max, $flow-text-from, $flow-text-to | 1.2rem, 1.68rem, 360px and 960px. Fluid type size and viewport bounds. |
$menu-item-height | 50px, the base used to size autocomplete image thumbnails at 10px less. |
$breakpoints, $sys-color-roles | Configurable maps for responsive boundaries and color role generation. Changing their keys affects the classes and tokens emitted by the build. |
$elevations, $button-sizes, $icon-button-sizes, $button-toggle-colors | Readable shared maps, without !default; they cannot be configured through @use ... with. Size maps have xsmall, small, medium, large and xlarge entries. The toggle map holds a (container, label) color pair per button style for false and true pressed states. |
$icon, $icon-label, $trend-arrow, $caret-down, $expand-more | Shared icon selectors and SVG image values. Changing them affects generated controls as well as authored markup. |
Names beginning with _ or - are Sass-private.
The forwarded $expressive-disabled selector is a shared implementation value,
not a configurable !default setting. $motion-fast-spatial is a
compatibility easing value; prefer the spring functions or motion tokens for new styles.
Functions
| Function | Arguments and result |
|---|---|
rem($px) | Converts a pixel length to rem using a 16px base. rem(24px) returns 1.5rem. |
breakpoint($name) | Returns the named lower boundary: compact 0px, medium 600px, expanded 840px, large 1200px or extra-large 1600px. Unknown names fail compilation. |
state-opacity($state) | Returns the token opacity as a CSS percentage calculation. Accepts hover, focus, pressed or dragged; unknown states fail compilation. |
state-layer($color, $state, $base: transparent) | Returns an OKLab color-mix() of the state color over the base, using that state's opacity token. |
spring($damping, $stiffness) | Returns a sampled CSS linear() easing. The arguments are damping ratio and stiffness. Pair it with the matching duration. |
spring-duration($damping, $stiffness) | Returns the settling time in seconds for the same spring. Use positive stiffness and the damping values shown in Transitions. |
General mixins
Call mixins with @include expressive.name(...) inside a selector unless the entry says otherwise.
| Mixin | Output |
|---|---|
bp-up($name), bp-down($name), bp-between($from, $to) | Wrap a content block in a media query. Lower bounds are inclusive; upper bounds are exclusive. |
z-depth($level, $important: false) | Sets a token-based shadow. Levels are 0, 1, 1-half, 2, 3, 4, 5. Unknown levels fail compilation. |
typescale($role, $emphasized: false) | Sets font family, size, weight, line height and letter spacing from the named type role. See Typography for all 15 roles. |
icon-size($size, $line-height: $size) | Sets an icon glyph's font size, width, height and line height. Pass 1 as the line height for a glyph on a text baseline. |
visually-hidden($important: false) | Clips content visually while retaining it for assistive technology and keyboard focus. |
focus-ring($offset: 2px) | Draws a 3px secondary-color outline on the selector where included, 2px outside it by default. A negative offset draws it inside. |
focus-visible($offset: 2px) | Draws the focus ring inside a nested &:focus-visible selector. |
list-reset() | Removes a list's markers, margin and padding. |
ellipsis() | Keeps text on one line and cuts it off with an ellipsis. |
fill-parent() | Positions the element absolutely over its whole positioned parent. |
print-hidden() | Hides the element when printing, with !important so no display rule brings it back. |
forced-colors-selected() | Adds an inset Highlight outline in forced-colors mode so selection remains visible. |
forced-colors-fill($color: CanvasText) | Preserves a drawn shape with a system background color in forced-colors mode. Use on an indicator or mask, not a whole content region. |
state-layer-ring($outer, $inner, $color, $state) | Draws a state-layer box-shadow between the outer and inner control sizes. |
glass($color) | Adds the optional translucent container and backdrop blur behind the glass style query. Pass the solid background color. Reduced transparency or increased contrast restores it. |
.notice {
@include expressive.z-depth("1");
@include expressive.focus-visible();
&:hover {
background: expressive.state-layer(var(--md-sys-color-primary), "hover");
}
@include expressive.bp-between("medium", "large") { padding: 1rem; }
}
Component mixins
These lower-level mixins build framework components. Prefer the documented HTML and classes
for application code. A mixin emits styles only; it does not add semantics, keyboard behavior or labels.
choice-fieldset, nav-destination and nav-destination-row
are available through the abstracts entry only; the main and custom entries hide them.
| Mixin | Contract |
|---|---|
btn($height, $border-radius, $padding-left, $padding-right, $font-size) | Button geometry and base interaction styles. Every argument is optional and defaults to small-button tokens, with 40px-equivalent height, full corners, 16px side insets and label-large type. |
btn-filled(), btn-tonal(), btn-elevated(), btn-outlined(), btn-flat() | Button colors, elevation, state tints and focus styles. Combine one with btn(). Flat corresponds to the text style. |
btn-disabled() | Disabled colors and pointer behavior. Native disabled or equivalent application behavior must enforce keyboard inactivity. |
button-size($name), icon-button-size($name) | Emit size custom properties from their corresponding size map. They do not emit type styles. |
btn-states($on, $base, $hover-depth: null, $press-depth: null) | Hover and focus state tints of $on over $base, plus the focus ring. The optional depths are z-depth() levels for hover and press. |
header-bar($gap), header-bar-headline() | The 64px-minimum header row of a full-screen dialog, side sheet or pane, with no fill or shadow, and its title-large heading that takes the free space. The caller sets the padding. |
text-action($selected: null, $container, $on-container) | Hover and selected states for a text item without button chrome. $selected is a selector suffix such as '[aria-current="page"]'; the selected item takes the secondary-container colors unless others are passed, plus a forced-colors outline. |
header-icon-action() | A 48px circular header action with a 24px-equivalent icon, hover tint and visible focus. |
card-media-trigger() | An absolutely positioned trigger covering card media, including state and focus styling. Use a positioned container and a named native control. |
trend-arrow(), tree-chevron() | Pseudo-element masks for an up-trend arrow or a closed tree branch. The consuming component rotates them for other states and RTL. |
choice-fieldset($radius, $control) | A wrapping fieldset of labelled choices. Pass the label radius and control selector used for focus and disabled states. |
selection-control($width, $height, $border-color) | Clears a checkbox, radio or switch input's native look to a box of the given size with a 2px border, so the control can be painted on the input. |
selection-control-states($outer, $inner, $checked: ":checked") | Hover, checked hover and focus state-layer rings from the inner size out to the outer size. $checked lists the states whose ring is primary. |
selection-control-label($display: flex) | A 48px minimum label row for a checkbox, radio or switch, with body-large type and a 12px gap. |
nav-destination($prefix, $inset, $transition) | Stacked navigation destination styles. The prefix names component tokens, such as nav-bar; inset is top padding and transition is a CSS transition value. Accepts an optional content block. |
nav-destination-row($prefix) | Changes the stacked destination to a horizontal row. Include after the stacked styles. |
chart($name, $colors: 4, $on-colors: false, $grid: true, $round: false, $rows: false, $tooltip: top, $cursor: null, $lines: false, $legend-columns: null) | At stylesheet top level, emits a chart's common container, plot, tooltip, labels, legend and tokens, with the supplied class prefix. The options add 5 or 6 series colors and their on-colors, drop the grid, draw a round or row-band plot, centre the tooltip, draw a line or band cursor, style SVG lines, and lay the legend out as a table of 3 or more columns. |
chart-axis($name, $beside: true) | At stylesheet top level, emits value labels and grid lines for the named chart. false leaves label spacing to the component. |
chart-column-motion() | Inside a column/bar container, animates marks from the zero line or previous values when reduced motion is not requested. |
Partial directory
Each component and utility partial links to its usage guide below.
For the custom entry's lists, remove components/ or utilities/.
For example, use "menu" in $components and "spacing"
in $utilities. "forms" includes the complete forms group;
a path such as "forms/checkboxes" selects one forms partial.
This alphabetical directory is a lookup table, not load order. Preserve the component index's order, with icons first, and include supporting partials. The recipes show working combinations. Base and token partials always load with either public stylesheet entry.
| Partial | Usage guide |
|---|---|
base/fonts | Typography |
base/global | Getting started |
base/grid | Grid |
base/normalize | Getting started |
base/print | Helpers |
base/prose | Typography |
base/typography | Typography |
components/accordion | Accordion |
components/alert | Alert |
components/aura | Aura |
components/avatar | Avatar |
components/back-to-top | Back to top |
components/badges | Badges |
components/bar-chart | Bar chart |
components/bottom-sheet | Bottom sheet |
components/breadcrumb | Breadcrumbs |
components/button-groups | Button groups |
components/buttons | Buttons |
components/calendar | Calendar |
components/cards | Cards |
components/carousel | Carousel |
components/cascader | Cascader |
components/chips | Chips |
components/column-chart | Column chart |
components/command-palette | Command palette |
components/confetti | Confetti |
components/countdown | Countdown |
components/data-table | Data table |
components/datepicker | Date picker |
components/description-list | Description list |
components/dialog | Dialogs |
components/docked-display | Date picker |
components/drag-handle | Drag handle |
components/empty-state | Empty state |
components/expanding-card | Cards |
components/fab-menu | FAB |
components/forms/checkboxes | Checkboxes |
components/forms/color-picker | Color picker |
components/forms/color-swatches | Color swatches |
components/forms/drop-zone | Drop zone |
components/forms/fieldset | Fieldsets |
components/forms/file-input | Text fields |
components/forms/input-fields | Text fields |
components/forms/radio-buttons | Radio |
components/forms/rating | Rating |
components/forms/select | Select |
components/forms/slider | Slider |
components/forms/switches | Switches |
components/funnel-chart | Funnel chart |
components/heatmap-chart | Heatmap chart |
components/icon-buttons | Icon buttons |
components/icons-material-design | Icons |
components/image-compare | Image compare |
components/keypad | Keypad |
components/kpi | KPI |
components/lightbox | Lightbox |
components/line-chart | Line chart |
components/list | Lists |
components/loading-indicator | Loading indicator |
components/loading-overlay | Loading overlay |
components/map | Map |
components/marquee | Marquee |
components/mega-menu | Mega menu |
components/menu | Menu |
components/menubar | Menubar |
components/message | Message |
components/message-scroller | Message scroller |
components/mixed-chart | Mixed chart |
components/modal-display | Time picker |
components/navbar | App bar |
components/navigation-bar | Navigation bar |
components/navigation-rail | Navigation rail |
components/org-chart | Organization chart |
components/page-footer | Footer |
components/pagination | Pagination |
components/panes | Panes |
components/particles | Particles |
components/pie-chart | Pie chart |
components/popover | Popover |
components/progress | Preloader |
components/pull-to-refresh | Pull-to-refresh |
components/questionnaire | Questionnaire |
components/radar-chart | Radar chart |
components/radial-chart | Radial chart |
components/rich-text-editor | Rich text editor |
components/sankey-chart | Sankey chart |
components/scatter-chart | Scatter chart |
components/scrim | Dialogs |
components/scrollspy | Scrollspy |
components/search | Search |
components/show-more | Show more |
components/side-sheet | Side sheet |
components/skeleton | Skeleton |
components/snackbar | Snackbar |
components/split-button | Split button |
components/stat | Stat |
components/stepper | Stepper |
components/swipe-actions | Swipe actions |
components/table_of_contents | Scrollspy |
components/tabs | Tabs |
components/timeline | Timeline |
components/timepicker | Time picker |
components/toolbar | Toolbars |
components/tooltip | Tooltips |
components/tour | Tour |
components/transfer-list | Transfer list |
components/transitions | Transitions |
components/tree | Tree |
components/treemap-chart | Treemap chart |
tokens/contrast | Themes |
tokens/elevation | Elevation |
tokens/motion | Transitions |
tokens/reference | Design tokens |
tokens/shape | Shapes |
tokens/stacking | Design tokens |
tokens/state | State layers |
tokens/theme | Themes |
tokens/vibrant | Themes |
utilities/colors | Color |
utilities/defer-render | Lists |
utilities/helpers | Helpers |
utilities/scroll-area | Scroll area |
utilities/shapes | Shapes |
utilities/spacing | Helpers |
utilities/typescale | Typography |
utilities/visibility | Helpers |
utilities/z-depth | Elevation |