Utilities
Utilities
Small classes that each do one thing — flex, items-center, gap-4, p-4 — for laying out a page without writing CSS. Short names, phone first.
Orders
1,284
<div class="flex flex-col md:flex-row md:items-center justify-between gap-3 p-4 bg-surface rounded-lg">
<div>
<div class="text-muted text-sm">Orders</div>
<div class="text-2xl font-bold">1,284</div>
</div>
<div class="flex gap-2">
<button class="btn">Export</button>
<button class="btn btn-default btn-solid">New order</button>
</div>
</div>
Make your window narrow: on phones the buttons sit under the number; from md (768px) up they move beside it.
Phone first
A class without a prefix works on every screen. Add a breakpoint in front and it applies from that width up — so you write the phone layout first, then change what needs changing on bigger screens.
| Prefix | From | Example |
|---|---|---|
| (none) | every screen | flex-col |
sm: | 576px | sm:flex-row |
md: | 768px | md:grid |
lg: | 1024px | lg:gap-8 |
xl: | 1280px | xl:max-w-5xl |
2xl: | 1536px | 2xl:p-12 |
Only from md up
Only on phones
<div class="hidden md:block">Only from md up</div>
<div class="md:hidden">Only on phones</div>
The spacing scale
Every spacing and size number means the same thing: the number × 4px. p-4 is 16px of padding, gap-6 is 24px, w-12 is 48px. The same scale is used by padding, margin, gap, space, width / height and the grid's gutters.
| Number | 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Size | 0px | 2px | 4px | 6px | 8px | 10px | 12px | 16px | 20px | 24px | 32px | 40px | 48px | 64px | 80px | 96px |
How they behave
- One class, one property.
items-centeronly setsalign-items; nothing else changes. - Utilities always win over components — they're the last layer of Moey's CSS, so
p-0on a card works without!important. - Start and end, not left and right.
ps-4andme-2follow the writing direction, so layouts flip correctly in right-to-left languages.
| Page | Classes |
|---|---|
| Display | block flex grid hidden … |
| Flex | flex-col flex-wrap flex-1 shrink-0 order-last … |
| Alignment | items-center justify-between self-end place-items-center … |
| Gap | gap-4 gap-x-2 gap-y-6 |
| Spacing | p-4 px-6 mt-2 mx-auto space-y-3 … |
| Sizing | w-full w-1/2 size-10 max-w-prose min-h-screen … |
| Text | text-sm · font-semibold · text-center · line-clamp-2 · uppercase |
| Borders | border · border-b · rounded-lg · divide-y |
| Effects | shadow · opacity-50 · transition · animate-spin |
| Position | relative · absolute · sticky · top-0 · inset-0 · z-10 |
| Overflow & visibility | overflow-auto · overscroll-contain · invisible · float-end |
| Aspect ratio & object fit | aspect-video · object-cover |
| Interactions | pointer-events-none · select-none · cursor-pointer |
| Container queries | @container · @md:flex-row |
| Background · Colors | bg-surface text-muted bg-blue-100 … |