Transform
Transform utilities move, scale, rotate, center, and adjust the visual origin of elements without writing custom CSS. They are ideal for hover states, floating cards, dropdown animations, centered overlays, decorative badges, and polished interaction details.
Hygular uses the individual CSS properties translate, scale, and rotate. No transform activation class is required. Translation utilities share --translate-x and --translate-y.
All transform utilities are pure CSS and do not require the Hygular runtime.
Quick reference
| Group | Classes | Effect | Common use |
|---|---|---|---|
| Centering |
| translate(...) / absolute centering | Modals, loaders, hero content, floating controls. |
| Scale |
| scale(...) | Hover lifts, pressed states, cards, icons, badges. |
| Translate |
| translate | Floating cards, offsets, micro-interactions. |
| Rotation |
| rotate(...) | Icons, arrows, badges, decorative UI. |
| Origin |
| transform-origin: ...; | Dropdowns, popovers, menus, directional animations. |
Usage
Scale, rotation, and translation utilities can be combined on the same element.
<div class="scale-105 rotate-3">
Interactive Card
</div>
How transforms compose
Scale utilities set scale, rotation utilities set rotate, and translation utilities set translate. These are separate CSS properties, so a rotation does not replace a scale.
<div class="scale-110 translate-y-2 rotate-3">Transformed content</div>
Centered element
Use translate-center when an element already has positioning and should be centered through translation.
<div class="translate-center">
Centered Element
</div>
Absolute center
Combine is-absolute top-50 start-50 translate-center inside a positioned parent to center an overlay.
<div class="is-absolute top-50 start-50 translate-center">
Modal Content
</div>
Scaled content
Scale utilities resize an element visually while preserving the surrounding document flow.
<div class="scale-105">
Enlarged Content
</div>
Vertical offset
Use translate utilities for subtle movement, hover lifts, and floating card effects.
<div class="translate-y-4">
Floating Card
</div>
Horizontal offset
Horizontal translate utilities are useful for decorative offsets, slide-in details, and controlled UI movement.
<div class="translate-x-4">
Offset Element
</div>
Rotated icon
Rotation utilities work well for icons, arrows, badges, and decorative labels.
<i class="rotate-90">
→
</i>
Centering utilities
| Class | Behavior | Recommended use |
|---|---|---|
translate-center | Centers on both axes. | Centered overlays, loader wrappers, positioned content. |
translate-x-center | Centers horizontally. | Tooltips, floating labels, horizontal alignment. |
translate-y-center | Centers vertically. | Side controls, vertical icons, rail buttons. |
is-absolute top-50 start-50 translate-center | Absolutely centers the element. | Modals, loaders, hero content, empty states, floating controls. |
Scale
Scale utilities resize elements visually. Use smaller values for professional interfaces and larger values only for decorative or explicit emphasis.
| Class | Value | Recommended use |
|---|---|---|
scale-0 | 0 | Hidden or collapsed transform state. |
scale-75 | 0.75 | Compact decorative elements. |
scale-90 | 0.90 | Small entrance or inactive states. |
scale-95 | 0.95 | Pressed buttons, dropdown start states. |
scale-100 | 1.00 | Default or reset scale. |
scale-105 | 1.05 | Hover cards, interactive surfaces. |
scale-110 | 1.10 | Icon emphasis and stronger hover states. |
scale-125 | 1.25 | Decorative emphasis and illustrations. |
Translate Y
Vertical translate utilities move elements up or down through the transform system.
| Class | Offset | Direction |
|---|---|---|
translate-y-1 | -0.25rem | Up |
translate-y-2 | -0.5rem | Up |
translate-y-3 | -0.75rem | Up |
translate-y-4 | -1rem | Up |
translate-y-8 | -2rem | Up |
-translate-y-1 | 0.25rem | Down |
-translate-y-2 | 0.5rem | Down |
-translate-y-3 | 0.75rem | Down |
-translate-y-4 | 1rem | Down |
-translate-y-8 | 2rem | Down |
Translate X
Horizontal translate utilities move elements left or right through the transform system.
| Class | Offset | Direction |
|---|---|---|
translate-x-1 | 0.25rem | Right |
translate-x-2 | 0.5rem | Right |
translate-x-3 | 0.75rem | Right |
translate-x-4 | 1rem | Right |
translate-x-8 | 2rem | Right |
-translate-x-1 | -0.25rem | Left |
-translate-x-2 | -0.5rem | Left |
-translate-x-3 | -0.75rem | Left |
-translate-x-4 | -1rem | Left |
-translate-x-8 | -2rem | Left |
Rotation
Rotation utilities are useful for icons, badges, decorative UI, disclosure arrows, and playful visual accents.
Subtle rotation
Use subtle rotations for badges, illustrations, stickers, and decorative UI.
| Class | Rotation | Recommended use |
|---|---|---|
rotate-1 | 1deg | Very subtle visual tilt. |
rotate-2 | 2deg | Soft decorative emphasis. |
rotate-3 | 3deg | Badges and sticker-like UI. |
rotate-12 | 12deg | Stronger decorative labels. |
-rotate-1 | -1deg | Very subtle reverse tilt. |
-rotate-2 | -2deg | Soft reverse emphasis. |
-rotate-3 | -3deg | Reverse badge tilt. |
-rotate-12 | -12deg | Strong reverse decorative labels. |
<div class="rotate-3">
Badge
</div>
Standard rotation
| Class | Rotation | Recommended use |
|---|---|---|
rotate-45 | 45deg | Directional indicators and decorative shapes. |
rotate-90 | 90deg | Arrows and rotated icons. |
rotate-180 | 180deg | Expanded/collapsed arrow states. |
rotate-270 | 270deg | Directional UI and icon orientation. |
-rotate-45 | -45deg | Reverse diagonal rotation. |
-rotate-90 | -90deg | Reverse quarter-turn rotation. |
Transform origin
Transform origin controls the point around which scaling and rotation happen. It is especially useful for dropdown menus, popovers, tooltips, and directional animations.
| Class | Origin | Recommended use |
|---|---|---|
origin-center | center | Balanced scale and rotation. |
origin-top | top | Menus opening downward. |
origin-top-right | top right | Right-aligned dropdown menus. |
origin-right | right | Side panels and right-edge motion. |
origin-bottom-right | bottom right | Menus or labels anchored from the lower right. |
origin-bottom | bottom | Elements expanding upward. |
origin-bottom-left | bottom left | Left-aligned upward motion. |
origin-left | left | Side navigation and left-edge motion. |
origin-top-left | top left | Left-aligned dropdown menus. |
Menu animation
<div
class="scale-95 origin-top-right"
>
Dropdown Menu
</div>
Real-world examples
Premium card lift
<div
class="translate-y-2 scale-105"
>
Feature Card
</div>
Floating action button
<button
class="translate-y-4 shadow-large"
>
+
</button>
Decorative badge
<div
class="rotate-12"
>
New
</div>
Centered loader
<div class="is-absolute top-50 start-50 translate-center">
Loading...
</div>
Rotating icon
<i class="rotate-180">
↓
</i>
Combining utilities
Scale + translate
<div
class="scale-105 translate-y-2"
>
Card
</div>
Rotate + scale
<div
class="rotate-3 scale-105"
>
Sticker
</div>
Translate + rotate
<div
class="translate-x-4 rotate-12"
>
Decorative Shape
</div>
Choosing the right transform
| Use case | Recommended utility |
|---|---|
| Subtle hover lift | transform + scale-105 + translate-y-2 |
| Perfectly centered overlay | is-absolute top-50 start-50 translate-center |
| Dropdown opening from a corner | origin-top-right + scale-95 |
| Rotating arrow indicator | transform + rotate-180 |
| Decorative badge | transform + rotate-12 |
Usage notes
- Always use
transformwhen combining transform utilities such as scale, translate, and rotate. - Use small scale values for professional interfaces;
scale-105is usually enough for hover emphasis. - Reserve large rotations for decorative elements, stickers, badges, and illustrations.
- Use
absolute-centerfor overlays, modals, loaders, hero content, and empty states. - Prefer subtle translations for hover and motion effects so the interface stays calm and premium.
- Combine transform utilities with
shadow,transition-all,hover:, andorigin-\*utilities for polished interactive states.