Docs :: Helpers Helpers are classes with high specificity for very targeted “one-off” local overrides. 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:
< div class = "myComponent pt-lg3 pb-lg3" >
< p >Content goes here.</ p >
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 to keep your CSS size to a minimum. For Astro users, the astro-purgecss integration 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 with your use case and I’ll add it in.
Spacing
File name Source help.spacing.cssGithub
width, height, margin, and padding You can combine these properties with any dimension token as well as 0:
CSS property Class prefix widthwheighthmarginmmargin-topmtmargin-bottommbmargin-leftmlmargin-rightmrpaddingppadding-topptpadding-bottompbpadding-leftplpadding-rightpr
Examples
Class Value w-lg1width: var(--lg1)ml-0margin-left: 0mb-sm1margin-bottom: var(--sm1)
< div class = "component mb-lg3" >
A component with an extra bottom margin of 48px.
< div class = "component p-md1" >
A component with an extra padding of 28px.
Colors
File name Source help.colors.cssGithub
color, background-color, and border-color You can combine this properties with any color token :
CSS property Class prefix colorcbackground-colorbgcborder-colorbdc
Examples
Class Value bgc-base-200background-color: var(--base-200)bdc-yes-500border-color: var(--yes-500)c-primary-500color: var(--primary-500)
A block with custom colors.
< div class = "c-base-0 bgc-primary-600" >
< p >A block with custom colors.</ p >
Layout
File name Source help.layout.cssGithub
overflow
CSS property CSS value Class Short class overflowauto.overflow-auto.of-autooverflowhidden.overflow-hidden.of-hiddenoverflowclip.overflow-clip.of-clipoverflowvisible.overflow-visible.of-visibleoverflowscroll.overflow-scroll.of-scrolloverflow-xauto.overflow-x-auto.of-x-autooverflow-yauto.overflow-y-auto.of-y-autooverflow-xhidden.overflow-x-hidden.of-x-hiddenoverflow-yhidden.overflow-y-hidden.of-y-hiddenoverflow-xclip.overflow-x-clip.of-x-clipoverflow-yclip.overflow-y-clip.of-y-clipoverflow-xvisible.overflow-x-visible.of-x-visibleoverflow-yvisible.overflow-y-visible.of-y-visibleoverflow-xscroll.overflow-x-scroll.of-x-scrolloverflow-yscroll.overflow-y-scroll.of-y-scroll
position Helper classes for the position property.
CSS value Class Short class static.position-static.staticfixed.position-fixed.fixedabsolute.position-absolute.absoluterelative.position-relative.relativesticky.position-sticky.sticky
visibility Helper classes for the visibility property.
CSS value Class Short class visible.visibility-visible.visiblehidden.visibility-hidden.hiddencollapse.visibility-collapse.collapsecollapse.visibility-collapse.collapse
z-index Helper classes for the z-index property. See also the z-index token docs .
Custom Property CSS Value Class --z-bottom-1000000000 .z-bottom--z-00 .z-0--z-110 .z-1--z-220 .z-2--z-330 .z-3--z-440 .z-4--z-550 .z-5--z-top1000000000 .z-top
Aspect ratios
File name Source help.ratios.cssGithub
Custom Property CSS Value Class --ar-square1 .ar-square--ar-landscape4/3 .ar-landscape--ar-portrait3/4 .ar-portrait--ar-widescreen16/9 .ar-widescreen--ar-golden1.618/1 .ar-golden
Opacity
File name Source help.opacity.cssGithub
Custom Property CSS Value Class --o-00 .o-0--o-10.2 .o-1--o-20.3 .o-2--o-30.5 .o-3--o-40.7 .o-4--o-51 .o-5
Typography
File name Source help.typography.cssGithub
font-family See the font stack tokens for details.
Custom Property Class Short class --text.font-text.text--display.font-display.display--mono.font-mono.mono
font-style
CSS value Class italic.font-italicnormal.font-normal
font-weight See the font weight tokens for details.
Custom Property Class Short class --extra-light.font-extra-light.extra-light--light.font-light.light--book.font-book.book--semi-bold.font-semi-bold.semi-bold--bold.font-bold.bold--black.font-black.black
font-size See the font size tokens for details.
Custom Property Class --text-xs.text-xs--text-sm.text-sm--text-dm.text-dm--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 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-leftcenter.text-centerright.text-rightjustify.text-justifystart.text-startend.text-end
text-transform
CSS value Class uppercase.text-uppercaselowercase.text-lowercasecapitalize.text-capitalize