Hyvä comes with the full Tailwind CSS library ready to use. Most merchants and developers use maybe 20% of what's available sticking to colours and basic padding. But Tailwind's real power is in the classes that handle layout, typography, interactivity, and visual polish all the things that separate a good-looking store from a great one.
Every class in this guide works in your existing Hyvä templates right now. No tailwind.config.js changes. No new build commands. Just open a .phtml file and start adding classes.
The Six Essential Class Categories
These six areas cover the vast majority of visual improvements you can make to a stock Hyvä store with zero customisation work. Each one targets a real pain point merchants notice unclear hierarchy, cramped layouts, flat buttons, poor mobile spacing.
Flexbox & Grid Classes
Control how elements sit next to each other rows, columns, gaps, alignment. The backbone of every Hyvä template.
flexgridgap-4items-center
Text Size & Weight Classes
Instant visual hierarchy headlines feel like headlines, body copy feels readable, prices feel prominent.
text-xlfont-boldleading-snugtracking-tight
Padding & Margin Classes
Consistent breathing room between elements. The single biggest impact on how "premium" a store feels.
p-4px-6mt-2space-y-3
Shape & Boundary Classes
Rounded corners, subtle dividers, and ring outlines that make inputs and cards look intentional, not default.
rounded-xlborderring-2divide-y
Hover & Motion Classes
Smooth hover states, colour fades, scale effects the microinteractions that make a store feel alive.
transitionhover:scale-105duration-200
Depth & Colour Classes
Backgrounds, shadows, text colours, and opacity the visual depth layer that separates cards and sections.
shadow-mdbg-whitetext-gray-900opacity-75
Category 1 Layout: Flexbox & Grid
The most common issue in stock Hyvä stores is elements stacking vertically when they should sit side-by-side, or grids that don't respond properly to different screen sizes. These classes fix that immediately.
Product Card Grid Responsive Columns
The default Hyvä product listing uses a basic grid. Add responsive column classes directly to the wrapper div in Magento_Catalog/templates/product/list.phtml and the grid instantly adapts from 1 column on mobile to 4 on desktop.
<div class="product-items">
<div class="grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4">
Header / Navbar Space Between
Hyvä's header templates already use flex in places, but inner rows often lack proper vertical alignment and gap control. Adding items-center and gap-4 to a nav row instantly fixes elements that feel "off" vertically.
<!-- Nav row: logo + search + icons perfectly aligned --> <div class="flex items-center justify-between gap-4 py-3 px-4"> <!-- Logo --> <a href="/" class="flex-shrink-0">...</a> <!-- Search --> <div class="flex-1 max-w-lg">...</div> <!-- Icons --> <div class="flex items-center gap-3 flex-shrink-0">...</div> </div>
Category 2 Typography: Instant Hierarchy
Typography is where most Hyvä stores feel generic. The default size scale is functional but flat everything looks roughly the same weight. These classes add proper hierarchy in seconds.
| Class | What it does | Best used on |
|---|---|---|
| text-2xl font-bold | Large, bold text strong visual anchor | Product name, page title, price |
| text-sm text-gray-500 | Small muted text deprioritises secondary info | SKU, meta info, review count |
| leading-snug | Tighter line height makes multi-line names feel compact | Product card titles (2-line clamp) |
| tracking-tight | Tighter letter spacing makes headings feel more typeset | H1, H2, section headings |
| line-clamp-2 | Truncates text to exactly 2 lines with ellipsis | Product card names in grid listings |
| truncate | Single-line truncation with ellipsis | Category names, breadcrumb items |
| uppercase tracking-widest text-xs | Spaced small-caps label style | Section labels, status badges, tags |
| font-semibold text-primary | Medium-weight coloured text emphasis without full bold | Price, CTA labels, links |
<!-- ❌ Before: flat, no hierarchy --> <p class="product-name"><?= $product->getName() ?></p> <p class="price"><?= $block->getProductPrice($product) ?></p> <!-- ✓ After: clear hierarchy, clean truncation --> <h3 class="text-sm font-semibold text-gray-900 leading-snug line-clamp-2 mb-1"> <?= $escaper->escapeHtml($product->getName()) ?> </h3> <p class="text-base font-bold text-primary"> <?= $block->getProductPrice($product) ?> </p>
Category 3 Spacing: The Premium Factor
No single change makes a store look more "premium" than consistent, generous spacing. Cramped elements signal low quality. These classes are the fastest ROI in this entire guide.
space-y-* Stack Children Consistently
Instead of adding mb-3 to every list item or card child, add space-y-3 to the parent container. It applies consistent vertical spacing between all direct children automatically and it's trivial to adjust globally later.
<ul> <li class="mb-2">...</li> <li class="mb-2">...</li> <li class="mb-2">...</li> </ul>
<ul class="space-y-2"> <li>...</li> <li>...</li> <li>...</li> </ul>
p-1 = 4px, p-2 = 8px, p-4 = 16px, p-6 = 24px, p-8 = 32px. Once this is instinct, you'll space everything consistently without thinking.
Category 4 Borders & Radius: Make Cards Feel Intentional
Default Hyvä product cards often have either square corners (feels like a spreadsheet) or inconsistent border radii across elements. A single rounded-xl and a light border border-gray-100 transforms the visual quality of every card on the page.
rounded-* Classes
Apply border radius to any element. Use rounded-xl for cards, rounded-lg for buttons, rounded-full for badges and avatars.
rounded-lgrounded-xlrounded-2xlrounded-full
border + border-color
Light borders make cards visible without heavy shadows. border border-gray-100 is the most-used combination in Hyvä stores.
borderborder-gray-100border-gray-200
divide-y / divide-x
Automatically adds a border between all direct children perfect for nav lists, order line items, or filter option rows.
divide-ydivide-gray-100divide-x
ring-* Focus States
Accessible focus rings for inputs, buttons, and links much better than browser defaults. Works perfectly with Alpine x-bind:class.
focus:ring-2focus:ring-primaryfocus:outline-none
Category 5 Transitions & Hover States
This is the category that makes the biggest perceived quality difference with the least code. A product card that subtly lifts on hover, a button that smoothly changes colour, an image that gently zooms these microinteractions signal that a store is well-made.
Product Card Hover Lift
Add this single class string to any product card wrapper and it gains a smooth lift-and-shadow effect on hover the visual equivalent of a card being picked up off the table.
<div class="bg-white rounded-xl border border-gray-100 shadow-sm hover:shadow-md hover:-translate-y-1 transition-all duration-200 overflow-hidden"> <!-- card content --> </div>
Button Hover States
Stock Hyvä buttons often have no hover feedback at all they just sit there, flat. Adding hover:bg-teal-700 transition-colors duration-150 and the subtle click-press effect active:scale-95 gives buttons proper interactive feedback.
<button class="w-full py-3 px-6 rounded-lg font-semibold text-sm text-white bg-primary hover:bg-teal-700 active:scale-95 transition-all duration-150 cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2"> Add to Cart </button>
Category 6 Colour & Shadow: Visual Depth
Flat stores look flat because every section has the same background and every card has the same weight. These classes add depth subtle backgrounds that section content, shadows that layer elements, and colour utilities that reinforce hierarchy.
| Class | Effect | Use in Hyvä |
|---|---|---|
| shadow-sm | Barely-visible shadow "floating" card effect | Product cards, mini-cart, dropdown panels |
| shadow-md | Moderate shadow used on hover state for lift effect | hover:shadow-md on cards |
| bg-gray-50 | Near-white background visually separates sections | Category page background, sidebar panels |
| bg-white | Pure white card sits above the page background | All product cards, checkout panels |
| text-gray-500 | Muted text secondary information that doesn't compete | Review counts, meta, helper text |
| bg-primary/10 | 10% opacity tint of your brand colour subtle highlight | Active filter pills, selected states, badges |
| overflow-hidden | Clips child content to parent border radius critical for image cards | Always pair with rounded-xl on image containers |
Bonus: Mobile-First Responsive Classes You Should Always Use
In Tailwind, every unprefixed class is the mobile baseline. Responsive prefixes (sm: md: lg:) add behaviour at that breakpoint and above. Here are the responsive patterns used most in Hyvä stores:
<!-- Stack on mobile, side-by-side from md up --> <div class="flex flex-col md:flex-row gap-6">...</div> <!-- Wider padding on larger screens --> <div class="px-4 sm:px-6 lg:px-8">...</div> <!-- Hide on mobile, show from md --> <div class="hidden md:block">...</div> <!-- Show only on mobile --> <div class="block md:hidden">...</div> <!-- Responsive text size --> <h1 class="text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight"> <?= $escaper->escapeHtml($block->getPageTitle()) ?> </h1> <!-- Responsive grid 1 col mobile, 2 tablet, 4 desktop --> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">...</div>
The Quick-Reference Cheat Sheet
Pin this. These are the classes that appear in almost every high-quality Hyvä template:
Every Layout File Needs
flexitems-centergap-4
gridgrid-cols-2flex-1
w-fullmax-w-7xlmx-auto
Every Product Card Needs
text-smfont-semiboldtext-gray-900
line-clamp-2leading-snugtruncate
text-basefont-bold
Every Card/Panel Needs
p-4px-4 py-3space-y-2
gap-3mb-1mt-auto
Every Card/Button Needs
rounded-xlrounded-lgoverflow-hidden
borderborder-gray-100
Every Interactive Element Needs
transition-allduration-200cursor-pointer
hover:shadow-mdhover:-translate-y-1active:scale-95
Every Page Section Needs
bg-whitebg-gray-50shadow-sm
text-gray-500text-gray-900
safelist in tailwind.config.js otherwise they'll be purged from the production build and disappear silently.
Final Thoughts
You don't need a design agency or a major rebuild to make your Hyvä store look significantly better. The classes in this guide are available right now in your existing theme, and most improvements take under five minutes to apply.
Start with the highest-impact areas: product card layout, typography hierarchy on names and prices, hover states on buttons and cards, and consistent spacing via space-y-* and gap-*. Those four changes alone will transform how your store feels to shoppers.
Once you're comfortable with these, the next step is building reusable component classes with @apply which removes repetitive class strings from your templates and makes global style changes trivial. That's where the real long-term efficiency lives.
Let Mavenbird Improve Your Hyvä Store's Frontend
From quick-win template improvements to full Hyvä design systems our certified Hyvä developers know exactly which classes, patterns, and component architectures deliver the best results for Magento merchants.