Utilities
Small one-job classes for layout and spacing, with the same short names as Moey: flex, gap-4, p-6, w-full. Use them to place components without writing CSS.
How they read
<div class="flex items-center justify-between gap-4 p-4 box">
<div class="flex items-center gap-3">
<span class="avatar bg-violet">HR</span>
<div><b class="block">Henry Richardson</b><span class="text-sm text-muted">Product designer</span></div>
</div>
<button class="btn btn-sm" type="button">Follow</button>
</div>Each class does one thing: flex lays children in a row, items-center centers them up and down, justify-between pushes them apart, gap-4 puts 16px between them, p-4 pads the box by 16px.
The spacing scale
Every number is × 4px: p-1 is 4px, p-4 is 16px, gap-6 is 24px, w-12 is 48px. The same scale runs through padding, margin, gap, width and height, so spaces line up across a page. The steps are 0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20 and 24 (sizes go on to 128).
Screen sizes
Classes work on phones first. Put a screen size in front to start a class from that width up: md:flex-row is a row from 768px, lg:grid-cols-3 is three columns from 1024px.
| Prefix | From | Typical screen |
|---|---|---|
| (none) | 0 | every screen, phones first |
sm: | 576px | large phones |
md: | 768px | tablets |
lg: | 1024px | laptops |
xl: | 1280px | desktops |
2xl: | 1536px | big screens |
<div class="flex flex-col md:flex-row gap-3">
<div class="box p-4 flex-1">Stacked on phones</div>
<div class="box p-4 flex-1">side by side from 768px</div>
<div class="box p-4 flex-1">(make the window narrow)</div>
</div>Layout, spacing, sizing, text size and alignment, position and overflow all have screen-size versions. Borders, colors, motion and interactions don't: they rarely change with the screen.
Box sizes instead of screen sizes
A card in a sidebar and the same card in the main column have very different room. Mark a box with @container, then @md:flex-row reacts to that box's width, not the screen's. Sizes: @xs 320px, @sm 384px, @md 448px, @lg 512px, @xl 576px, @2xl 672px.
<div class="@container box p-4">
<div class="flex flex-col @md:flex-row @md:items-center gap-3">
<span class="stat-icon-box"><i class="mi mi-folder" aria-hidden="true"></i></span>
<div class="flex-1"><b class="block">Website redesign</b><span class="text-sm text-muted">12 files · edited today</span></div>
<button class="btn btn-sm" type="button">Open</button>
</div>
</div>Layout essentials have box-size versions: display, direction and wrap, grid columns (1, 2, 3, 4, 6), alignment, gap, padding, text alignment and widths.
Utilities always win
Momo puts its CSS in three layers: foundations, then components, then utilities. A utility beats a component's own style however that style is written, so p-0 on a card body really removes its padding. CSS you write yourself (outside any layer) beats all of Momo, so overriding never needs !important.
All utility pages
- Display & flex: show, hide, rows, columns, alignment
- Grid & gap: columns, spans, auto-fit cards, gaps
- Spacing: padding, margin, space between
- Sizing: width, height, min and max
- Text: size, weight, alignment, wrapping, truncation
- Position & overflow: sticky, absolute, layers, scrolling, pictures
- Borders & effects: lines, corners, dividers, opacity, motion
- Interactions: cursors, selecting, touch, scrolling