Vibe Design Tips

遞進式圓角與連續曲率圓角

004 Continuous Corners

遞進式圓角與連續曲率圓角

元件視覺效果

巢狀圓角如何逐層計算,以及什麼時候改用連續曲率圓角,讓卡片和表單的轉角更規整。

一張圓角 16px、內距 8px 的卡片,裡面的按鈕也用 16px 圓角,轉角處兩條邊框的間距就會比直邊處寬,按鈕看起來沒有貼合卡片;較大的圓角接直邊的地方,還會有一道折痕。做法有以下四條:

  1. 等距內縮:用於表單、巢狀卡片、對話框這類有內外兩層圓角的地方。每一層都依「內圓角 = 外圓角 − 間距」計算,內外共用一個圓心,轉角處的間距才會和直邊處相同。卡片圓角 16、內距 8,裡面的按鈕圓角就是 8。
  2. 多層巢狀:三層以上時,由外往內逐層計算。對話框圓角 32、內距 16,內部面板和按鈕為 16;面板裡再內縮 8 放一個標籤,標籤為 8。同一層級的元素共用一個圓角,最小不低於 4。
  3. 膠囊和圓形:巢狀在容器裡的膠囊形和圓形元素不參與計算,始終保持完整的圓形。
  4. 連續曲率圓角:用於圓角較大、連接處看得出折痕,或想要接近 iOS 圓角觀感的情況。一般圓角在接直邊處曲率突然變化,連續曲率圓角(超橢圓)讓曲率逐漸增大,過渡更順。寫法是 border-radius: 32px; corner-shape: superellipse(1.25);

另外,corner-shape 目前只有 Chrome 和 Edge 139 以上版本支援;Safari 和 Firefox 會自動改用一般圓角,不需要額外處理。

附帶的提示詞會由外往內重新計算你指定介面的圓角;專案中有圓角 token 時,直接修改 token。

Prompt複製後傳給 Claude Code、Cursor 等 Agent 即可
Make the corner radii in this UI consistent, then switch them to continuous
corners. Work on the screen or components I name; ask me if I have not
named them. If the project has radius tokens, change those instead of
hard-coding values.

1. Inner radius = outer radius - padding (r = R - p)
- Go from the outside in: dialog or card -> panels, inputs, buttons ->
  chips and tags. A box p inside a container with radius R gets R - p,
  so both corners share one center. Example: dialog 32, padding 16 ->
  panels and buttons 16; a chip 8 inside a 16 panel -> 8.
- Boxes on the same level share one radius. Never go below 4.
- Pills and circles stay fully round.
- Keep every padding, gap and radius on a 4px grid.

2. Continuous corners
- Keep border-radius and add the curve as progressive enhancement:
    @supports (corner-shape: superellipse(1.25)) {
      :where(*) { corner-shape: superellipse(1.25); }
    }
  Set corner-shape: round on pills and circles.
- Chrome and Edge 139+ render it; Safari and Firefox skip the block and
  show the plain border-radius.

When done, list every radius you changed as "element: old -> new".