The Tailwind classes designers actually use
A reference for spacing, type, colour, layout, borders and states. The classes that show up in almost every interface, written the way a properties panel is written.

Zander Whitehurst
18 min read
Tailwind looks enormous the first time you open the docs. Thousands of classes, most of which you will not touch this year. The set you need to design and review interface work is much smaller. It maps onto the Figma properties panel: spacing, size, layout, type, fill, stroke, radius, shadow, and the states of a control.
This is that set, written as a reference. I assume you have already met the idea in Tailwind CSS for designers. If you are still deciding whether utilities belong in the product at all, read CSS and Tailwind utilities first. Values below are the defaults. A team theme can rename colours and change the type scale. The shape of the classes stays the same.
How a class is built
Most classes are a property, then a value on a scale.
p-4 is padding at step 4. text-sm is the small text size. bg-white is a white fill. Prefixes add a condition: md:p-6 is that padding from the medium breakpoint up, hover:bg-gray-50 is that fill on hover, dark:bg-gray-900 is that fill in dark mode.
Read a long class string from the outside in. Layout first, then spacing, then type and colour, then border and radius, then state prefixes. You do not have to write them in that order. You will review them faster if you scan them in that order.
Spacing
The spacing scale is shared by padding, margin, gap, width and height. Each step is 0.25rem. At the usual 16px root size, the step is 4px.
| Class step | Pixels | Use it for |
|---|---|---|
0 | 0 | Reset a margin the browser added |
1 | 4px | Icon-to-label gaps, tight stacks |
2 | 8px | Compact controls, chip padding |
3 | 12px | Default gap inside a card |
4 | 16px | Page padding on small screens, button padding |
6 | 24px | Card padding, section stacks |
8 | 32px | Space between sections |
12 | 48px | Large section padding |
16 | 64px | Hero padding, big vertical rhythm |
The prefix says which side.
p-6is padding on all sides.px-6is left and right.py-6is top and bottom.pt-6,pr-6,pb-6,pl-6are one side.m-6,mx-6,my-6,mt-6and the rest are the same idea for margin. Prefer gap over margin between siblings.gap-4is the gap in a flex or grid parent.gap-x-4andgap-y-6split horizontal and vertical.
Negative margins exist (-mt-4) and are usually a smell in product UI. If you are pulling something out of the padding, the structure is probably wrong.
space-y-4 puts vertical margin between children. It breaks the moment a child is hidden or wrapped in another element. flex flex-col gap-4 is the one I trust.
Sizing
Width and height use the same numbers, plus a handful of layout words.
w-4andh-4are 16px. This is the right size for a small icon slot.w-fullis 100% of the parent.h-fullneeds the parent to have a height.w-screenis the viewport width. It ignores the parent and will cause horizontal scroll if anything else adds padding. Preferw-full.min-w-0lets a flex child shrink below its content, which is how you stop a long email address from blowing out a row. I add this more often than I expect to.max-w-sm,max-w-md,max-w-lg,max-w-xlandmax-w-2xlcap a column.max-w-proseis the readable line length.size-9sets width and height together. Handy for icon buttons.
w-fit sizes to the content. flex-1 lets the item fill leftover space in a row. shrink-0 stops an icon or button from being squashed.
Layout
If you use auto layout in Figma, this is the panel you already know.
<div class="flex items-center justify-between gap-3">
flexis horizontal auto layout.flex-colmakes it vertical.inline-flexis for controls that should sit in a line of text.items-centercentres on the cross axis.items-startanditems-stretchare the other everyday choices.items-baselinealigns type that mixes sizes.justify-start,justify-center,justify-endandjustify-betweenare the main-axis alignment.justify-betweenis "space between".flex-wraplets items wrap. Pair it withgap-2rather than margins.
Grid is for two-dimensional layout, usually a responsive set of cards.
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
col-span-2 makes an item cover two columns. grid-cols-[1fr_240px] is a main column plus a fixed sidebar, and one of the few arbitrary values I am happy to see.
Display words you will actually use:
blockandinlinefor the rare case you are changing an element's box.hiddenremoves it. Pair with a breakpoint when it should come back:hidden md:block.contentsmakes the element's children participate in the parent layout. Use it rarely and on purpose. It can confuse accessibility mappings.
Position
Most product UI should not be positioned. Flex and grid cover it. When you do need position, the set is small.
relativeon the parent,absoluteon the child, thentop-2 right-2to pin a badge to a corner.inset-0stretches an overlay to all four edges of the relative parent.fixed inset-x-0 bottom-0is a mobile action bar.sticky top-0is a bar that pins once you scroll.z-10andz-50are enough layers for almost every screen. If you needz-[9999], something else is wrong.isolatestarts a new stacking context when overlaps get weird. It is a tool for fixing a bug, not a style.
Typography
Type classes cover family, size, weight, leading, tracking and colour.
| Class | What a designer should picture |
|---|---|
text-xs | 12px. Meta, captions, overlines |
text-sm | 14px. Secondary UI copy, dense tables |
text-base | 16px. Body |
text-lg | 18px. Card titles, large body |
text-xl to text-3xl | Section titles up to page titles |
font-normal | 400 |
font-medium | 500. The weight most UI labels want |
font-semibold | 600. Headings |
leading-none | Tight, for a single-line title |
leading-snug | Comfortable UI text |
leading-relaxed | Long-form reading |
tracking-tight | Large headings |
tracking-wide | Small overlines in uppercase |
uppercase | Use with text-xs tracking-wide |
Alignment is text-left, text-center and text-right. Colour is text-gray-900 for primary text and text-gray-500 for secondary, until the theme gives you semantic names like text-foreground and text-muted-foreground.
Truncation:
truncateis one line with an ellipsis. The parent needs a bounded width.line-clamp-2is two lines, then an ellipsis.whitespace-nowrapkeeps a label on one line. Pair it withtruncateor the line will overflow.
tabular-nums makes digits the same width, which is what you want in prices, timers and tables. I notice immediately when a dashboard is missing it.
Colour
Default palettes run from 50 (lightest) to 950 (darkest): bg-gray-50, text-gray-900, border-gray-200. Product code should grow out of these and into tokens.
bg-white,bg-transparent,bg-black/5for a wash. The/5is 5% opacity.text-blue-600for a link or a primary label on a light surface.ring-blue-500for focus, notborder, so the control does not shift layout.- Semantic theme names, once they exist:
bg-background,bg-card,bg-primary,text-primary-foreground,border-border. Match these to Figma variables. The class is only as good as the name.
Do not ship raw hex in the markup (bg-[#2563EB]) for anything that belongs to the system. An arbitrary colour is reasonable for a one-off illustration or a brand moment that will never be a token. It is not reasonable for a button.
Border, radius, shadow
Stroke in Figma is border plus a colour and sometimes a width. border is 1px on every side. border-b is only the bottom, which is how dividers and input underlines are usually made. border-gray-200 is the colour. border-2 is the width, and you rarely need it.
Radius:
| Class | Pixels | Typical use |
|---|---|---|
rounded | 4px | Small chips, checkboxes |
rounded-md | 6px | Inputs, compact buttons |
rounded-lg | 8px | Buttons, menus |
rounded-xl | 12px | Cards |
rounded-2xl | 16px | Large cards, modals |
rounded-full | pill | Avatars, badges, icon buttons |
rounded-t-lg rounds only the top. Use it when a card header and body are separate elements and should read as one shape.
Shadow is elevation, and product UI needs very little of it.
shadow-smfor cards on a gray page.shadow-mdfor menus and popovers.shadow-lgfor modals.ring-1 ring-black/5as a hairline when a full shadow feels heavy.
Focus is a ring, not a glow someone invented. focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 is the pattern. focus-visible shows the ring for keyboard users and stays quiet for mouse clicks. outline-none without a ring is a bug.
States and breakpoints
Prefixes are the variants. They always sit in front of the class they change.
Interaction:
hover:for pointer hover. Do not hide information here.focus-visible:for keyboard focus.active:for the pressed moment. A slightly darker fill is enough.disabled:opacity-50 disabled:pointer-events-nonefor a control that cannot be used. Also set thedisabledattribute in HTML. The class only changes the look.placeholder:text-gray-400for input hints.aria-expanded:anddata-[state=open]:when a component library exposes state. Radix and similar libraries use the data attribute. Read it as "while this is open".
Responsive, mobile first. An unprefixed class applies at every size. A prefixed class applies from that breakpoint up.
| Prefix | Min width | Picture it as |
|---|---|---|
sm: | 640px | Large phone, small tablet |
md: | 768px | Tablet |
lg: | 1024px | Laptop |
xl: | 1280px | Desktop |
grid-cols-1 md:grid-cols-2 is one column, then two. You do not also write a "mobile" prefix. The unprefixed class is the small screen.
dark: follows the user's colour scheme, or the class strategy your app chose. Check which one the project uses before adding it. A dark: class in a project that never toggles dark mode is dead code.
A few classes that save a review
These are the ones I look for when a layout feels almost right.
min-w-0andtruncateon text in a flex row.shrink-0on icons and buttons that must keep their size.object-coveron images that should fill a frame and crop.object-containwhen the whole image must stay visible.aspect-videooraspect-squarewhen the frame needs a ratio before the image loads.overflow-hiddenon a card that clips a media edge to the radius.overflow-autoon a region that should scroll on its own.pointer-events-noneon decorative layers so they do not steal clicks.sr-onlyfor a label that should be read by a screen reader and not shown. The accessible name still has to exist.transition-colorswhen a hover colour changes. Skip transitions on layout properties. They make the interface feel slow.cursor-pointeron a real control is unnecessary for buttons and links. If you need it, you may have styled adivas a button.
Arbitrary values
Square brackets escape the scale: top-[13px], grid-cols-[1fr_240px], bg-[#2563EB].
Use them when the scale has no honest value for the situation, usually a one-off grid or a nudge to align with something outside the system. Do not use them for spacing you could round to the scale. p-[13px] means the design and the system disagree, and the system should win unless you have a reason you can say out loud.
What to memorise, and what to look up
Memorise the spacing steps 1 through 8, the type sizes from text-xs to text-xl, the flex line flex items-center gap-2, and the state prefixes hover, focus-visible and disabled. Look everything else up. The docs are organised by the same properties.
When you review a generated component, check four things before you talk about taste.
- Spacing is on the scale. No mystery pixel values.
- Colour comes from the theme, or from a palette step the team has agreed to use.
- Every interactive control has a hover, a focus-visible ring and a disabled treatment.
- The small-screen classes work with no prefix, and larger screens only add what changes.
That pass catches more broken UI than a pixel-perfect overlay. Keep this page open while you do it. The matching walkthrough of shipping the change in a reviewable size is how big a PR should be.
Memorisely