Vibe Design Tips

有按压反馈的拟物按钮

001 Skeuomorphic Buttons

有按压反馈的拟物按钮

组件视觉效果

一组有点击手感的拟物按钮:五个层级、五层材质,以及悬停和按下时的光影变化,适合后台和工具类产品。

扁平按钮按下时通常只是颜色略微变深,快速点击时几乎看不出来;拟物按钮按下时会下沉,位置、渐变和阴影同时变化,用户能确认这一下按到了。要点有以下五条:

  1. 五个层级:适合按钮多、颜色少的后台、编辑器和设置页,主次只能靠明暗和材质区分。从强到弱为 primary 深石板色按键、secondary 凸起的白色按键、tertiary 浅灰按键、ghost 平时无底色、text 只有文字和细下划线;同一区域只放一个 primary。
  2. 五层材质:有底色的三个层级都由同样的五层构成:顶部浅 6–8% 的渐变面,比渐变底部深一级的 1px 描边,顶部一道白色高光,底部一道暗线,以及贴地阴影加柔和投影两层。层级之间只有数值不同,五层定义成一组 token,由各层级分别赋值。
  3. 悬停与按下:悬停时按键面亮一级,投影变大。按下时下移 1px,渐变上下翻转,投影收到几乎贴地,顶部高光变成一道内阴影。静止和按下的内阴影层数要相同,不足的用透明阴影补齐,阴影才会平滑过渡。
  4. 光源与颜色:光源固定在正上方,高光总在顶部、暗线总在底部,整组按钮看起来在同一个空间里。只用中性灰,不用品牌色,层级靠明暗区分;也不用镜面高光、外发光和大面积模糊。
  5. 按字号缩放:高度、内边距、圆角、描边和每层阴影的偏移、模糊,都写成单位 u = 字号 / 14 的倍数。14px 文字时 u = 1px,按钮高 40px;16px 文字时 u ≈ 1.14px,按钮高约 45.7px,阴影按同一比例放大。

参数

尺寸
文字 14px;高 40px;圆角 10px;左右内边距 18px
按下
下移 1px;投影收为 0 1px 1px
时长
位移 120ms;阴影 140ms;颜色 160ms

附带的 Prompt 会优先改造项目里已有的按钮组件,保留原有的接口和无障碍设置;项目里没有按钮组件时,才新建一个。

Prompt复制后发给 Claude Code、Cursor 等 Agent 即可
Define a tactile, skeuomorphic Button component with five variants, from
strongest to weakest: primary, secondary, tertiary, ghost, text.
If the project already has a component library or design system, do not
add a new component: restyle its existing Button through its own variant
and token system, and keep its API, props and accessibility as they are.
Otherwise create one reusable Button with `variant` and `size` props.

Style: calm and precise, like the Lumno browser extension and the Cloudflare
dashboard. Neutral grays only, no brand hues. Lit from straight above.
No glossy Web 2.0 shine, no glow, no large blur.

Variants:
1. primary   - near-black slate face (#404859 -> #273042), white label
2. secondary - raised white key (#FFFFFF -> #F4F5F7), dark gray label
3. tertiary  - soft gray key (#F3F4F6 -> #E7E9EC), dark gray label
4. ghost     - no face at rest; faint gray fill on hover; a recessed well
               when pressed
5. text      - gray label with a thin underline and an arrow that nudges
               right on hover

Every filled variant is the same five material layers; only the values
change, so define them once as tokens and let each variant set its own:
1. Face: 180deg linear gradient, top 6-8% lighter than bottom.
2. Edge: 1px solid border one step darker than the bottom of the face
   (primary #12161F, secondary rgba(15,23,42,.14), tertiary rgba(15,23,42,.1)).
3. Top highlight: inset 0 1px 0 white (18% on slate, 85-100% on light
   faces). Put every inset layer in the button's own box-shadow, before the
   drop layers, never on a pseudo-element overlay: inset shadows on the
   element follow the inner radius (outer radius minus border), so the
   corners line up in every state.
4. Bottom shade: inset 0 -1px 0 black (22% on slate, 6% on light faces).
5. Drop shadow in two layers: a tight contact shadow 0 1px 2px plus a soft
   lift 0 4px 10px -3px (18% and 28% on slate, about a third of that on
   light faces).

States (hover, pressed/active, focus-visible, disabled):
- Hover: face one step lighter; the lift grows to 0 8px 16px -5px.
- Pressed: translateY(1px); flip the gradient (darker on top); the outer
  shadow collapses to 0 1px 1px; the top highlight becomes an inner shadow,
  inset 0 1px 2px black (40% on slate, 12-16% on light faces). Light faces
  keep a 1px white line below, 0 1px 0 rgba(255,255,255,.9), like a key
  pressed into paper.
- Give rest and pressed the same number of inset layers (pad with
  inset 0 0 0 transparent) so the shadow animates instead of jumping.
- Focus-visible and disabled follow the library's existing conventions.
- Timing: 120ms for transform, 140ms for shadows, 160ms for colors.

Sizes: all values above are for the 14px label size: height 40px,
padding 0 18px, radius 10px, label weight 600, optional 16px leading icon.
On the slate face add a label text-shadow 0 -1px 0 rgba(0,0,0,.28).
Scale the material with the type, never keep it at fixed pixels: express
every length (height, padding, radius, border, icon, the 1px press offset,
and every shadow offset, blur and spread) as a multiple of a size unit
u = label size / 14. Provide two sizes: md (14px label, u = 1px) and
lg (16px label, u = 16/14 px, so height 45.7px, radius 11.4px, lift shadow
0 4.6px 11.4px -3.4px).