Skip to content

Commit 0a40624

Browse files
duyetduyetbot
andcommitted
feat(frontend-design): add micro-interaction polish patterns
Enhanced frontend-design skill with 11 micro-interaction patterns: - Typography: text-wrap balance/pretty, antialiased smoothing, tabular-nums - Border radius: concentric formula for nested elements - Icon animations: contextual states with scale/opacity - Animation: interruptible transitions, split/stagger enter, subtle exit - Alignment: optical vs geometric centering - Depth: shadows over borders, ultra-subtle image outlines - Timing: responsive interaction speeds (150-400ms) Co-Authored-By: duyetbot <duyetbot@users.noreply.github.com>
1 parent e7b619d commit 0a40624

2 files changed

Lines changed: 229 additions & 1 deletion

File tree

frontend-design/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend-design",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "Create distinctive, production-grade frontend interfaces avoiding AI slop aesthetics. Emphasizes shadcn/ui, Recharts, and bold design choices.",
55
"author": {
66
"name": "duyet",

frontend-design/skills/frontend-design/SKILL.md

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,231 @@ When implementing frontend:
455455
- Comments for non-obvious choices
456456

457457
Remember: Claude is capable of extraordinary creative work. Commit fully to a distinctive vision that could only have been designed for this specific context.
458+
459+
## Micro-Interaction Polish
460+
461+
The difference between good and exceptional interfaces lies in microscopic details that users feel but don't consciously notice. These patterns make interfaces feel "expensive" and polished.
462+
463+
### 1. Typography Enhancement
464+
465+
**Text Wrapping for Headlines**:
466+
```css
467+
/* Prevents awkward widows in headlines */
468+
.hero-title {
469+
text-wrap: balance; /* Optimizes line breaks for headlines */
470+
}
471+
472+
/* For multi-line text where you want pretty breaks */
473+
.description {
474+
text-wrap: pretty; /* Last line minimum 4 characters */
475+
}
476+
```
477+
- Use `balance` for headlines, titles, and short text blocks
478+
- Use `pretty` for descriptions, summaries, and body text where you want to avoid orphans
479+
480+
**Font Smoothing**:
481+
```css
482+
body {
483+
-webkit-font-smoothing: antialiased;
484+
-moz-osx-font-smoothing: grayscale;
485+
}
486+
```
487+
- Critical for Mac rendering—removes "thin" look from fonts
488+
- Makes text appear more substantial and premium
489+
- Apply globally to `body` or typography containers
490+
491+
**Tabular Numbers**:
492+
```css
493+
.price, .metric, .stat {
494+
font-variant-numeric: tabular-nums;
495+
}
496+
```
497+
- Essential for data, prices, metrics—prevents jitter when numbers animate
498+
- Use for anything that changes value dynamically
499+
- Avoids visual shifting during countdowns, tickers, or live data
500+
501+
### 2. Border Radius Consistency
502+
503+
**Concentric Formula**:
504+
```css
505+
/* Outer radius = Inner radius + padding */
506+
.card {
507+
padding: 1.5rem;
508+
border-radius: 16px;
509+
}
510+
511+
.card-inner {
512+
border-radius: calc(16px - 1.5rem); /* Concentric borders align perfectly */
513+
}
514+
```
515+
- When nesting elements with borders, adjust inner radius by subtracting padding
516+
- Creates perfect alignment between concentric rounded corners
517+
- Prevents "thick border" appearance at corners
518+
519+
### 3. Icon Animation Patterns
520+
521+
**Contextual Icon States**:
522+
```css
523+
.icon {
524+
transition: all 0.2s ease;
525+
opacity: 0.6;
526+
transform: scale(1);
527+
}
528+
529+
.icon:hover {
530+
opacity: 1;
531+
transform: scale(1.1);
532+
}
533+
534+
.icon.active {
535+
opacity: 1;
536+
transform: scale(1);
537+
filter: drop-shadow(0 0 8px currentColor);
538+
}
539+
```
540+
- Icons should breathe: subtle scale + opacity changes
541+
- Use `filter: drop-shadow()` instead of `box-shadow` for icons (respects shape)
542+
- Keep animations under 200ms for responsive feel
543+
544+
### 4. Animation Philosophy
545+
546+
**Interruptible Animations**:
547+
```css
548+
/* GOOD: CSS transitions—user can interrupt */
549+
.button {
550+
transition: transform 0.2s ease, opacity 0.2s ease;
551+
}
552+
.button:hover {
553+
transform: translateY(-2px);
554+
}
555+
556+
/* AVOID: Keyframes for interactions—can't be interrupted */
557+
@keyframes slideUp {
558+
from { transform: translateY(20px); opacity: 0; }
559+
to { transform: translateY(0); opacity: 1; }
560+
}
561+
```
562+
- Use CSS **transitions** for user-triggered animations (hover, click, focus)
563+
- Transitions can be interrupted when user moves away/clicks quickly
564+
- Reserve keyframes for continuous, non-interactive animations (loaders, backgrounds)
565+
566+
**Split and Stagger Enter**:
567+
```css
568+
/* Elements enter from different directions */
569+
.card:nth-child(3n+1) { animation: slideFromLeft 0.4s ease forwards; }
570+
.card:nth-child(3n+2) { animation: slideFromBottom 0.4s ease forwards; }
571+
.card:nth-child(3n+3) { animation: slideFromRight 0.4s ease forwards; }
572+
573+
/* Stagger with delay */
574+
.card:nth-child(1) { animation-delay: 0ms; }
575+
.card:nth-child(2) { animation-delay: 50ms; }
576+
.card:nth-child(3) { animation-delay: 100ms; }
577+
```
578+
- Vary entrance directions based on position for visual interest
579+
- Stagger delays: 50-100ms between elements feels premium, not sluggish
580+
- Never exceed 300ms total delay—users hate waiting for content
581+
582+
**Subtle Exit Animations**:
583+
```css
584+
.modal.closing {
585+
animation: fadeOut 0.15s ease forwards;
586+
}
587+
@keyframes fadeOut {
588+
to { opacity: 0; transform: scale(0.98); }
589+
}
590+
```
591+
- Exits should be faster than enters (150ms vs 300-400ms)
592+
- Users want to dismiss things quickly
593+
- Skip exit animations if it delays navigation
594+
595+
### 5. Alignment Precision
596+
597+
**Optical vs Geometric Alignment**:
598+
```css
599+
/* Geometric center looks "off" with triangle icons */
600+
.icon-triangle {
601+
transform: translateY(-1px); /* Nudge down for optical center */
602+
}
603+
604+
/* Circles appear smaller than squares at same size */
605+
.icon-circle {
606+
transform: scale(1.1); /* Slight scale for visual balance */
607+
}
608+
```
609+
- Trust your eyes, not the grid
610+
- Triangles, stars, and irregular shapes need optical adjustment
611+
- Different shapes at same "size" need visual balancing
612+
- Test: squint—if something feels off, adjust by 1-2px
613+
614+
### 6. Depth Without Borders
615+
616+
**Shadows Over Borders**:
617+
```css
618+
.card {
619+
/* Instead of: border: 1px solid #e5e5e5; */
620+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08),
621+
0 1px 2px rgba(0, 0, 0, 0.04);
622+
}
623+
624+
.card-elevated {
625+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
626+
0 2px 4px -1px rgba(0, 0, 0, 0.06);
627+
}
628+
```
629+
- Shadows create depth without harsh edges
630+
- Layer multiple shadows for subtle, natural elevation
631+
- Borders can look "flat" or "boxed in"
632+
- Exception: use borders for grouping, dividers, or interactive states
633+
634+
**Image Outlines**:
635+
```css
636+
.image-container {
637+
position: relative;
638+
}
639+
640+
.image-container::after {
641+
content: '';
642+
position: absolute;
643+
inset: 0;
644+
border: 1px solid rgba(255, 255, 255, 0.1);
645+
border-radius: inherit;
646+
pointer-events: none;
647+
}
648+
```
649+
- Ultra-subtle 1px border at 10% opacity adds polish to images
650+
- Creates clean separation without visual weight
651+
- Use on images, cards, or featured content
652+
- In dark mode, use white with low opacity; light mode, use black
653+
654+
### 7. Micro-Interaction Timing
655+
656+
```css
657+
/* Fast interactions feel responsive */
658+
.fast-interaction { transition-duration: 150ms; }
659+
660+
/* Standard interactions feel smooth */
661+
.standard-interaction { transition-duration: 200ms; }
662+
663+
/* Slow animations feel deliberate */
664+
.deliberate-motion { transition-duration: 400ms; }
665+
```
666+
- 150ms: hover states, button clicks, toggle switches
667+
- 200ms: card lifts, dropdown opens, tooltip appears
668+
- 400ms+: page transitions, modal enters, complex animations
669+
- Never use 1s+ for anything—feels sluggish
670+
671+
### Micro-Interaction Checklist
672+
673+
Before shipping UI:
674+
- [ ] Headlines use `text-wrap: balance`
675+
- [ ] Font smoothing is applied (`antialiased`)
676+
- [ ] Numbers/data use `tabular-nums`
677+
- [ ] Concentric borders align (radius - padding formula)
678+
- [ ] Icons breathe (scale + opacity on hover)
679+
- [ ] User interactions use transitions (not keyframes)
680+
- [ ] Entrance animations are split/staggered
681+
- [ ] Exit animations are faster than enter
682+
- [ ] Irregular icons are optically aligned
683+
- [ ] Depth uses shadows (not borders)
684+
- [ ] Images have ultra-subtle outlines
685+
- [ ] Animation timing feels responsive (≤200ms for interactions)

0 commit comments

Comments
 (0)