Vibe Design Tips

Nút skeuomorphic lún xuống khi nhấn

001 Skeuomorphic Buttons

Nút skeuomorphic lún xuống khi nhấn

Thành phầnHiệu ứng

Nút skeuomorphic có cảm giác nhấn thật: năm kiểu nút, năm lớp chất liệu, ánh sáng và bóng đổ đổi theo khi rê chuột và khi nhấn, hợp với trang quản trị và sản phẩm dạng công cụ.

Nút phẳng khi nhấn thường chỉ đậm màu hơn một chút, nhấp nhanh thì gần như không nhận ra; nút skeuomorphic khi nhấn sẽ lún xuống, vị trí, dải chuyển màu và bóng đổ cùng thay đổi, người dùng biết chắc mình đã nhấn trúng. Có năm điểm chính:

  1. Năm kiểu nút: phù hợp với trang quản trị, trình soạn thảo và trang cài đặt có nhiều nút nhưng ít màu, nơi chính phụ chỉ có thể phân biệt bằng độ sáng tối và chất liệu. Từ mạnh đến nhẹ: primary là phím màu xám đá đậm, secondary là phím trắng nổi lên, tertiary là phím xám nhạt, ghost bình thường không có nền, text chỉ có chữ và một đường gạch chân mảnh; mỗi khu vực chỉ đặt một nút primary.
  2. Năm lớp chất liệu: ba kiểu nút có nền đều gồm năm lớp giống nhau: mặt chuyển màu với phần trên sáng hơn 6–8%, viền 1px đậm hơn một bậc so với đáy dải chuyển màu, một đường sáng trắng ở mép trên, một đường tối ở mép dưới, và hai lớp bóng gồm bóng sát mặt đất cộng bóng đổ mềm. Các kiểu nút chỉ khác nhau về giá trị; năm lớp được định nghĩa thành một bộ token, mỗi kiểu nút gán giá trị riêng.
  3. Rê chuột và nhấn: khi rê chuột, mặt phím sáng lên một bậc, bóng đổ lớn hơn. Khi nhấn, nút dịch xuống 1px, dải chuyển màu đảo ngược trên dưới, bóng đổ thu lại gần như sát mặt đất, đường sáng ở mép trên chuyển thành một lớp bóng trong. Số lớp bóng trong ở trạng thái nghỉ và khi nhấn phải bằng nhau, thiếu thì bù bằng bóng trong suốt, bóng mới chuyển đổi mượt mà.
  4. Nguồn sáng và màu sắc: nguồn sáng cố định ở ngay phía trên, đường sáng luôn ở mép trên, đường tối luôn ở mép dưới, cả bộ nút trông như nằm trong cùng một không gian. Chỉ dùng màu xám trung tính, không dùng màu thương hiệu, phân biệt kiểu nút bằng độ sáng tối; cũng không dùng ánh phản chiếu như gương, vầng sáng bên ngoài hay làm mờ diện rộng.
  5. Co giãn theo cỡ chữ: chiều cao, khoảng đệm, bo góc, viền cùng độ dịch và độ mờ của từng lớp bóng đều viết thành bội số của đơn vị u = cỡ chữ / 14. Với chữ 14px thì u = 1px, nút cao 40px; với chữ 16px thì u ≈ 1.14px, nút cao khoảng 45.7px, bóng đổ phóng to theo cùng tỉ lệ.

Thông số

Kích thước
Nhãn 14px; chiều cao 40px; bo góc 10px; khoảng đệm ngang 18px
Khi nhấn
Dịch xuống 1px; bóng đổ thu về 0 1px 1px
Thời lượng
Transform 120ms; bóng 140ms; màu 160ms

Prompt đi kèm sẽ ưu tiên sửa thành phần nút sẵn có của dự án, giữ nguyên API và các thiết lập trợ năng; chỉ khi dự án chưa có thành phần nút thì mới tạo mới.

PromptDán vào một Agent như Claude Code hoặc Cursor
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).