
Interactive Hit Areas
Skill修复相邻可交互元素之间的悬停与点击死区:图表柱、列表行、导航项、标签页等用 gap 或 margin 留白时,指针落在间隙里会失效或闪烁;改为让元素紧贴铺满各自的槽位,把视觉间距移到元素内部,附 React/Tailwind 示例。
name: interactive-hit-areas
description: Use when interactive elements that have visual spacing between them (chart bars/columns, list rows, nav items, segmented controls, tabs, calendar cells, icon buttons, legend chips) need hover or click to respond across the whole region with no dead zones. Triggers on "dead space", "deadspace", "gap between bars/items isn't clickable", "hover flickers between items", "have to aim precisely", "hit area too small", "highlight drops out between". Covers separating the hit area from the visual area, why gap/margin/space-between creates dead zones, and the flush-target + inner-spacing fix.
Interactive Hit Areas
Separate the hit area (where pointer events land) from the visual area (what the user sees). Bugs happen when spacing is built so that the gap between items has no event handler — the pointer falls into a dead zone and hover/click does nothing or flickers.
The core rule
Visual spacing between interactive siblings must live INSIDE each hit target, never BETWEEN them.
- WRONG: spacing via
gap,space-x, ormarginbetween the interactive elements. The space is empty DOM — no handler — so it's dead. - RIGHT: interactive elements sit flush (no gap), each filling its full slot and carrying the handler; the visual element inside is made narrower/inset (padding,
max-width, or a centered child) so it still looks spaced.
Result: the entire region is a continuous strip of live targets, but it looks identical to the spaced design.
Symptom & detection
- Symptom: moving the pointer slowly between two items, the highlight blinks off in the space between them, or you must aim directly at the small visual element to trigger it.
- Detect: sweep the cursor horizontally/vertically across the whole component. If the active/hover state ever drops out while still inside the component's bounds, you have dead zones.
- The bigger the visual gap, the bigger the dead zone — so "nice airy spacing" makes it worse.
The fix (general)
- Identify the repeating slot (one item's full share of the axis — its pitch).
- Make the interactive container fill that whole slot, flush against its neighbors (remove
gap/space-*/marginbetween siblings; useflex-1/equal grid tracks). - Put the handler (
onMouseEnter,onClick,:hover) on that full-slot container. - Recreate the visual spacing inside: center a narrower visual element (
max-width, fixed width +items-center), or usepaddingon the container around full-bleed content. Padding is part of the element, so it stays a live target; margin/gap is not.
React / Tailwind specifics
- Replace
gap-Nbetween hover/click items withgap-0(flush) and move the spacing inside each item (padding, or a centered child withmax-w-[Npx]). - Keep sibling rows that must stay column-aligned (e.g. bars and their labels/icons) on the same gap setting — if one row is flush and another has
gap, their centers drift apart. Flush +flex-1on both keeps centers aligned. - For lists/menus: put vertical rhythm as
py-*on each row, not asspace-y-*/gap-*between rows, when the whole row strip should be clickable. - Accessibility tie-in: this is also how you hit the 24–44px minimum target size — grow the hit area with padding while keeping the glyph small.
Worked example (bar chart)
Spaced bars where hovering anywhere over a bar's column highlights it:
// Container: flush columns, NO gap — the whole width is live.
<div className="absolute inset-0 flex items-stretch">
{bars.map((bar, i) => (
<div
key={bar.id}
// flex-1 = one full slot/pitch; full height = hover above the bar too
className="flex flex-1 flex-col items-center justify-end"
onMouseEnter={() => setHovered(i)}
onMouseLeave={() => setHovered(null)}
style={{ opacity: hovered !== null && hovered !== i ? 0.4 : 1 }}
>
<span>{bar.value}</span>
{/* visual spacing comes from the narrower CENTERED bar, not a gap */}
<div className="w-full" style={{ maxWidth: 37, height: bar.value * UNIT }} />
</div>
))}
</div>
Anti-pattern that caused the bug: flex ... gap-2 with w-full bars. The bars touched their slots, so the only spacing was the 8px gap between columns — and that gap was dead to the pointer.
When gaps between items ARE fine
Dead zones only matter when you want "anywhere in the region targets the nearest item." If items are meant to be discrete and the space between them is genuinely inert (e.g. cards on a page, unrelated buttons), gap is correct — don't force flush layouts everywhere. Apply this skill when the design intends a continuous interactive band with visual separation.
相關資源

Design Lab
Skill先通过提问了解设计范围、痛点、参考产品、品牌调性与约束,再从项目现有的 Tailwind 配置、CSS 变量或组件库主题中提取视觉语言,在临时路由里生成 5 个不同的界面方案并附带交互式反馈浮层,按反馈迭代后输出实现计划,结束或取消时清理所有临时文件。面向 Next.js、Vite 等 React 项目。
0xdesign/design-plugin788
Build Primitive
Skill在 Base UI 没有现成原语时,按 Prototyper UI 的规范从零构建基础组件:先定 ARIA 契约,再做键盘导航、焦点管理、受控与非受控状态、表单集成与动画,复杂交互优先包装 react-table、cmdk 等无样式库。
PrototyperAI/prototyper-ui8
shadcn/ui
Skillshadcn/ui 官方技能:让 agent 借助 shadcn CLI 读取项目配置与组件文档,按规范添加、搜索、组合和修复组件,遵守样式、表单与无障碍规则,也能用预设初始化新项目。
shadcn-ui/ui130k
OKLCH Colors
Skill在网页项目中使用 OKLCH 色彩空间:把 hex、rgb、hsl 转成 oklch,生成没有色相漂移的色阶与暗色模式配色,用 APCA 或 WCAG 检查对比度并只调亮度来修正,处理 P3 色域与 sRGB 回退,以及 Tailwind v4 的 @theme 配置;修改结果以前后对照表呈现。
jakubkrehel/oklch-skill291
Smooth Shadow Ring
Skill给卡片、对话框、下拉菜单、提示框等浮起的元素加阴影时,用 smooth-shadow-ring 系列工具类代替边框或 ring 加阴影的写法,避免出现两道边线,并说明描边与阴影的着色、暗色模式和覆盖方式。需要项目里装了 shadow-plugin 这个 Tailwind 插件。
flornkm/shadow-plugin148
Paper to Code Components
Skill把 Paper 设计稿(经 Paper MCP、Viewfinder 或导出的 JSX)实现为 React/Next.js 代码前先梳理层级、识别可复用组件;每个图标单独成组件,任意值收进 globals.css 令牌,优先复用 shadcn 组件,移植真实字体,图表按数据建模。
millionco/skills35