Version 2.0.0 rebuilds Assembly with UnoCSS while keeping the existing class names and buildUserAssets API.
Most markup works unchanged. Continue to use assembly.css / assembly.js, or keep calling Assembly.buildUserAssets. Check grids, txt-break-word, and switches for the changes below.
What can change:
- The contents of
assembly.cssare generated by UnoCSS, so whitespace, comments, rule order, and source maps may differ from 1.x. Selectors and declarations for public classes stay the same, except for the grid,txt-break-word, and switches. - Conflicting margin and padding classes resolve as in 1.x: a single-side class beats an axis class, so
px12 pl6gives 6px of left padding. Versions 2.0.0 to 2.0.2 let the larger value win instead; upgrade to 2.0.3 or later. - Layout-scale media variants (
px12-mm,w-1/2-ml, and so on) now use the same custom media queries you pass tobuildUserAssets, instead of the hardcoded default breakpoints. - Focus states use the CSS
:focus-visiblepseudo-class, so the browser decides when to show them.assembly.jsfocus control andAssembly.setFocusStatenow only affect selects. Text inputs and textareas don't get an outline; they keep their darker border color on focus. - Focused elements get a
2px solid var(--blue)outline instead of a box-shadow. The--focus-shadowvariable is replaced by--focus-outline; if you passed--focus-shadowtobuildUserAssets, pass anoutlinevalue as--focus-outlineinstead. @mapbox/assemblynow depends on@unocss/core(used when creating custom builds).- When the user prefers reduced motion, transitions on every element, including your own, finish instantly.
Switches were restyled:
.switchis 24px tall and.switch--lis 36px tall, matchinginput--sandinput. Use the new.switch--sfor the previous 18px height.switch--s-labelis removed..switch-containercenters the switch on its label, so delete the class.switch--{color}only colors the track when checked. The unchecked track is alwaysgray-lightand the dot is white unless you addswitch--dot-{color}.- The
<div class='switch'>can sit anywhere inside.switch-container, as long as the<input>is a direct child of the container.
New: you can use Assembly as an UnoCSS preset for on-demand CSS:
import { defineConfig } from 'unocss';
import { presetAssembly } from '@mapbox/assembly';
export default defineConfig({
presets: [presetAssembly()]
});presetAssembly() tree-shakes utilities from your source. The prebuilt assembly.css uses presetAssembly({ safelist: true }). Reset, forms, buttons, and other component CSS are preflight and always included.
The generated CSS still uses Assembly's CSS variables and custom media queries, so it needs a PostCSS step with postcss-custom-properties and postcss-custom-media. See presetAssembly in the README for the config.
grid is now a 12-column CSS Grid instead of a flexbox row. grid, col, w-1/12 to w-11/12, and grid--gut{size} keep their names. Check grids that rely on flexbox behavior:
col--autois removed. For columns that share the remaining space, useflexwithflex-child-growon the children.- A
colwithout a width class spans the full row instead of sizing to its content. For content-sized columns, useflex. flex-child-*classes have no effect on acol.- Left and right margin classes on a
colare ignored.ml-1/12toml-11/12still offset acol, and need aw-*fraction class next to them.mr-1/12tomr-11/12have no grid equivalent. - Give every direct child of
gridthecolclass, including children that only have aw-*fraction class. grid--gut{size}setscolumn-gapinstead of a negative margin ongridand padding oncol. Addgapy{size}for space between rows.
txt-break-word uses overflow-wrap: anywhere instead of word-break: break-all, so words break only when they would overflow their container.
These are additive with 1.x class names:
gap12/gapx12/gapy12(padding scale) forflexandgridspacing.aspect-16/9,object-cover,flex--space-evenly-main,rotate90,scale50.animation-shimmer,visible-on-parent-hover,bg-canvas,bg-canvas--dark.
Version 1.0.0 of Assembly introduces breaking changes – learn how to resolve them with this handy guide.
In addition to the changes outlined in this guide, 1.0.0 drops support for IE11. If you need to continue supporting IE11, we recommend staying on an older version of Assembly or migrating to another CSS framework.
These classes have been renamed to make room for new viewport width classes:
viewport-third→h-viewport-1/3viewport-half→h-viewport-1/2viewport-twothirds→h-viewport-2/3viewport-almost→h-viewport-11/12viewport-full→h-viewport-full
flex-child has been removed and flex-child--{x} modifiers are no longer modifiers:
flex-childno longer exists. In almost all cases, it only impacted rendering in IE11, so you may safely to remove all instances of this class.flex-child--grow→flex-child-growflex-child--no-shrink→flex-child-no-shrink
flex-parent and all modifiers have been renamed:
flex-parent→flexflex-parent-inline→inline-flexflex-parent--column→flex--columnflex-parent--column-reverse→flex--column-reverseflex-parent--row→flex--rowflex-parent--row-reverse→flex--row-reverseflex-parent--center-main→flex--center-mainflex-parent--center-cross→flex--center-crossflex-parent--start-main→flex--start-mainflex-parent--start-cross→flex--start-crossflex-parent--end-main→flex--end-mainflex-parent--end-cross→flex--end-crossflex-parent--wrap→flex--wrapflex-parent--stretch-cross→flex--stretch-crossflex-parent--space-between-main→flex--space-between-main
col no longer declares flex-basis:0 or flex-grow: 1;. As a result, elements that use the col class without a width class will no longer grow to fill available space. To reintroduce the previous behavior, add the col--auto modifier to elements that use col without a width class.
Generic percentage based width classes now take the place of col--{n} & col--off{'r' | 'l'}{n} modifier classes.
col--1→w-1/12col--2→w-1/6col--3→w-1/4col--4→w-1/3col--5→w-5/12col--6→w-1/2col--7→w-7/12col--8→w-2/3col--9→w-3/4col--10→w-5/6col--11→w-11/12col--12→w-fullcol--offr1→mr-1/12col--offr2→mr-1/6col--offr3→mr-1/4col--offr4→mr-1/3col--offr5→mr-5/12col--offr6→mr-1/2col--offr7→mr-7/12col--offr8→mr-2/3col--offr9→mr-3/4col--offr10→mr-5/6col--offr11→mr-11/12col--offl1→ml-1/12col--offl2→ml-1/6col--offl3→ml-1/4col--offl4→ml-1/3col--offl5→ml-5/12col--offl6→ml-1/2col--offl7→ml-7/12col--offl8→ml-2/3col--offl9→ml-3/4col--offl10→ml-5/6col--offl11→ml-11/12
All scroll-{*} classes except scroll-styled have been renamed to to overflow-{*}.
scroll-always→overflow-scrollscroll-auto→overflow-autoscroll-hidden→overflow-hidden
Previously, loading included margin:auto to center the loader horizontally by default. Add mx-auto to the loading element to reintroduce this behavior.
Before 1.0.0, Assembly had a complex limiter class that was convenient but inflexible. You can use these existing classes to exactly imitate limiter: wmax1200 w-11/12-mm w-5/6-ml mx-auto px24 px0-mm.
Every icon has been redrawn in 1.0.0 and some icons have been removed. If you use any of the following icons, seek an alternative source:
adjust-strokeapplerenamed toiosfacebookinstagramjslifebouylinkedinnofolderqtslacktooltipunitywechat
col--offl12 and col--offr12 no longer exist. Reintroduce them with:
.col--offl12 {
margin-left: 100% !important;
}
.col--offr12 {
margin-right: 100% !important;
}txt-spacing4 no longer exists. Reintroduce it with:
.txt-spacing4 {
letter-spacing: 0.4em !important;
}btn--stroke--2 no longer exists. Reintroduce it with:
.btn--stroke--2 {
box-shadow: inset 0 0 0 2px currentColor;
}
.btn.btn--stroke--2:disabled {
box-shadow: inset 0 0 0 2px var(--inactive-text-color);
}
.btn--pill-stroke.btn--stroke--2.btn--pill-hc {
margin-left: -2px;
margin-right: 0;
}
.btn--pill-stroke.btn--stroke--2.btn--pill-hr {
margin-left: -2px;
}
.btn--pill-stroke.btn--stroke--2.btn--pill-vc {
margin-top: -2px;
margin-bottom: 0;
}
.btn--pill-stroke.btn--stroke--2.btn--pill-vb {
margin-top: -2px;
}- The height of
toggleis now 30px, down from 36px and the height oftoggle-sis now 18px, down from 24px. - The default form control color is gray, originally blue, for all form types.
- The typographic scale has been updated. Notably
txt-mis now 16px, up from 15px and many headings have a smaller font-size. - Shadow classes now have a y-offset.
- The default
selectis now borderless. To add a border, useselect--stroke.