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

附帶的提示詞會優先改造專案中現有的按鈕元件,保留原有的 API 和無障礙設定;專案中沒有按鈕元件時,才新建一個。

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).