make-interfaces-feel-better by jakubkrehel/make-interfaces-feel-better
npx skills add https://github.com/jakubkrehel/make-interfaces-feel-better --skill make-interfaces-feel-better优秀的界面很少源于单一因素。通常是众多微小细节的累积,共同造就卓越的体验。在构建或审查 UI 代码时,请应用以下原则。
外圆角 = 内圆角 + 内边距。嵌套元素间不匹配的圆角是导致界面感觉不协调的最常见原因。
当几何居中看起来不协调时,采用视觉对齐。带有图标的按钮、播放三角形以及非对称图标都需要手动调整。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
使用多个透明的 box-shadow 值叠加来营造自然的深度感。阴影能适应任何背景;而实线边框则不能。
对于交互式状态变化,使用 CSS 过渡——它们可以在动画中途被中断。将关键帧动画保留给需要一次性运行的、分阶段的序列。
不要为单个容器设置动画。将内容拆分为语义块,并以约 100 毫秒的延迟错开每个块的动画。
使用一个小的固定 translateY 值,而不是完整的高度变化。退出动画应比进入动画更柔和。
使用 opacity、scale 和 blur 来动画化图标,而不是切换可见性。请精确使用这些值:scale 从 0.25 到 1,opacity 从 0 到 1,blur 从 4px 到 0px。如果项目的 package.json 中有 motion 或 framer-motion,则使用 transition: { type: "spring", duration: 0.3, bounce: 0 }——bounce 必须始终为 0。如果未安装运动库,则将两个图标都保留在 DOM 中(一个使用绝对定位),并使用 cubic-bezier(0.2, 0, 0, 1) 的 CSS 过渡进行交叉淡入淡出——这可以在不依赖任何库的情况下实现进入和退出动画。
在 macOS 上,对根布局应用 -webkit-font-smoothing: antialiased 以获得更清晰的文本。
对任何动态更新的数字使用 font-variant-numeric: tabular-nums,以防止布局偏移。
在标题上使用 text-wrap: balance。在正文文本上使用 text-wrap: pretty 以避免孤行。
为图像添加一个低不透明度的细微 1px 轮廓,以保持一致的深度感。
点击时使用细微的 scale(0.96) 为按钮提供触觉反馈。始终使用 0.96。切勿使用小于 0.95 的值——任何低于此值的缩放都会显得夸张。当动画会分散注意力时,添加一个 static 属性来禁用它。
在 AnimatePresence 上使用 initial={false} 以防止首次渲染时的进入动画。请验证这不会破坏有意的入场动画。
transition: all始终指定确切的属性:transition-property: scale, opacity。Tailwind 的 transition-transform 涵盖了 transform, translate, scale, rotate。
will-change仅用于 transform、opacity、filter——这些是 GPU 可以合成的属性。切勿使用 will-change: all。仅在注意到首帧卡顿时才添加。
交互式元素至少需要 40×40 像素的点击区域。如果可见元素较小,则使用伪元素进行扩展。切勿让两个元素的点击区域重叠。
| 错误 | 修复方法 |
|---|---|
| 父元素和子元素使用相同的边框圆角 | 计算 outerRadius = innerRadius + padding |
| 图标看起来不居中 | 通过内边距进行视觉调整或直接修复 SVG |
| 区块间使用硬边框 | 使用带透明度的分层 box-shadow |
| 生硬的进入/退出动画 | 拆分、错开并保持退出动画的柔和性 |
| 数字导致布局偏移 | 应用 tabular-nums |
| macOS 上文字厚重 | 对根元素应用 antialiased |
| 页面加载时播放动画 | 向 AnimatePresence 添加 initial={false} |
元素上使用 transition: all | 指定确切的属性 |
| 首帧动画卡顿 | 添加 will-change: transform(谨慎使用) |
| 小型控件上的点击区域过小 | 使用伪元素扩展到 40×40 像素 |
initial={false}transition: all——只指定特定属性will-change 仅用于 transform/opacity/filter,绝不用于 allwill-change 使用每周安装量
1.9K
代码仓库
GitHub 星标数
244
首次出现
13 天前
安全审计
安装于
cursor1.8K
codex1.8K
opencode1.8K
amp1.8K
kimi-cli1.8K
gemini-cli1.8K
Great interfaces rarely come from a single thing. It's usually a collection of small details that compound into a great experience. Apply these principles when building or reviewing UI code.
| Category | When to Use |
|---|---|
| Typography | Text wrapping, font smoothing, tabular numbers |
| Surfaces | Border radius, optical alignment, shadows, image outlines, hit areas |
| Animations | Interruptible animations, enter/exit transitions, icon animations, scale on press |
| Performance | Transition specificity, will-change usage |
Outer radius = inner radius + padding. Mismatched radii on nested elements is the most common thing that makes interfaces feel off.
When geometric centering looks off, align optically. Buttons with icons, play triangles, and asymmetric icons all need manual adjustment.
Layer multiple transparent box-shadow values for natural depth. Shadows adapt to any background; solid borders don't.
Use CSS transitions for interactive state changes — they can be interrupted mid-animation. Reserve keyframes for staged sequences that run once.
Don't animate a single container. Break content into semantic chunks and stagger each with ~100ms delay.
Use a small fixed translateY instead of full height. Exits should be softer than enters.
Animate icons with opacity, scale, and blur instead of toggling visibility. Use exactly these values: scale from 0.25 to 1, opacity from 0 to 1, blur from 4px to 0px. If the project has motion or framer-motion in package.json, use — bounce must always be . If no motion library is installed, keep both icons in the DOM (one absolute-positioned) and cross-fade with CSS transitions using — this gives both enter and exit animations without any dependency.
Apply -webkit-font-smoothing: antialiased to the root layout on macOS for crisper text.
Use font-variant-numeric: tabular-nums for any dynamically updating numbers to prevent layout shift.
Use text-wrap: balance on headings. Use text-wrap: pretty for body text to avoid orphans.
Add a subtle 1px outline with low opacity to images for consistent depth.
A subtle scale(0.96) on click gives buttons tactile feedback. Always use 0.96. Never use a value smaller than 0.95 — anything below feels exaggerated. Add a static prop to disable it when motion would be distracting.
Use initial={false} on AnimatePresence to prevent enter animations on first render. Verify it doesn't break intentional entrance animations.
transition: allAlways specify exact properties: transition-property: scale, opacity. Tailwind's transition-transform covers transform, translate, scale, rotate.
will-change SparinglyOnly for transform, opacity, filter — properties the GPU can composite. Never use will-change: all. Only add when you notice first-frame stutter.
Interactive elements need at least 40×40px hit area. Extend with a pseudo-element if the visible element is smaller. Never let hit areas of two elements overlap.
| Mistake | Fix |
|---|---|
| Same border radius on parent and child | Calculate outerRadius = innerRadius + padding |
| Icons look off-center | Adjust optically with padding or fix SVG directly |
| Hard borders between sections | Use layered box-shadow with transparency |
| Jarring enter/exit animations | Split, stagger, and keep exits subtle |
| Numbers cause layout shift | Apply tabular-nums |
| Heavy text on macOS | Apply antialiased to root |
| Animation plays on page load | Add initial={false} to |
initial={false} for default-state elementstransition: all — only specific propertieswill-change only on transform/opacity/filter, never allwill-change usageWeekly Installs
1.9K
Repository
GitHub Stars
244
First Seen
13 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor1.8K
codex1.8K
opencode1.8K
amp1.8K
kimi-cli1.8K
gemini-cli1.8K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
transition: { type: "spring", duration: 0.3, bounce: 0 }0cubic-bezier(0.2, 0, 0, 1)AnimatePresencetransition: all on elements | Specify exact properties |
| First-frame animation stutter | Add will-change: transform (sparingly) |
| Tiny hit areas on small controls | Extend with pseudo-element to 40×40px |