YL

BUTTON

危险操作按钮Destructive Button

红色实心表示会删掉东西,左边一枚同样大小的取消,避免手滑就生效。

中英对照

中文
危险操作按钮
英文
Destructive Button
别名
删除按钮、危险按钮、Destructive Action
一句话
红色实心表示会删掉东西,左边一枚同样大小的取消,避免手滑就生效。

效果预览

常见变体

二次确认按钮Two-step Confirm

不弹对话框:第一次点击文案变成「确认删除?」并加深底色,5 秒内再点一次才执行;按钮仍在聚焦或悬停时不复位,离开后超时才复位。

描边危险按钮Outline Destructive

风险较低或不想喧宾夺主的位置(设置页底部的「退出登录」):白底红字红描边,悬停才变成浅红底。

适合用在哪

删除项目、清空数据、退出登录、不可撤销的提交。

不适合:可撤销的日常操作(归档邮件、移出收藏、从购物车移除):用红色危险按钮会夸大风险,也会让用户对红色逐渐麻木;这类操作直接执行,再给一个「撤销」提示更顺手。

和相近模式的区别

按钮层级体系Button Hierarchy

如果操作可以撤销、或者只是普通的次要动作,就回到层级体系里用 Secondary 或 Ghost,不要上红色;即使真的危险,它也受层级约束:沿用主按钮的高度、圆角和内边距,同一屏里不能比真正的主 CTA 更大、更显眼。

容易踩的坑

  • 单击就删除,没有确认,误触无法挽回。
  • 红色按钮比页面主 CTA 更大更亮,用户分不清哪个才是推荐操作。
  • 用浅红字配白底冒充危险按钮,对比度不够,也不像按得下去。

设计提示词 · Prompt

危险操作按钮(Destructive Button):删除、清空、退出登录用红色实心(#dc2626 一带)+ 白字,高度、圆角与主按钮一致,对比度至少 4.5:1。旁边放一枚同等大小的取消(Ghost 或描边):取消在左、危险在右。危险按钮不要比页面主 CTA 更大。点击后先确认(对话框,或按钮文案先变成「确认删除」再执行),不要单击即毁。禁用态降到 45% 透明度并加 not-allowed,不要用浅红字在白底上冒充危险按钮。
Destructive Button: delete, clear, and log-out use a solid red (around #dc2626) with white text, the same height and radius as the primary button, and at least 4.5:1 contrast. Place an equal-size cancel (ghost or outlined) beside it: cancel on the left, destructive on the right. Don't make the destructive button larger than the page's primary CTA. Confirm before acting (a dialog, or a first click that changes the label to "Confirm delete"). The disabled state drops to 45% opacity with a not-allowed cursor — don't fake a destructive button with pale red text on white.

可复制 CSS

自包含的最小实现,粘贴到空白页面即可生效;类名可以按项目规范改名。

/* <div class="danger-row"><button class="danger-row__cancel" type="button">取消</button><button class="danger-btn" type="button">删除项目</button></div> */
.danger-row { display: flex; justify-content: flex-end; gap: 12px; }
.danger-btn,
.danger-row__cancel {
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: 600 15px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.danger-btn { background: #dc2626; color: #fff; }
.danger-btn:hover:not(:disabled) { background: #b91c1c; }
.danger-btn.is-confirming, .danger-btn.is-confirming:hover { background: #991b1b; }
.danger-btn:disabled { opacity: .45; cursor: not-allowed; }
.danger-row__cancel { background: #fff; color: #111827; border-color: #d1d5db; }
.danger-row__cancel:hover { background: #f9fafb; border-color: #9ca3af; }
.danger-btn:focus-visible { outline: 2px solid #b91c1c; outline-offset: 2px; }
.danger-row__cancel:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .danger-btn, .danger-row__cancel { transition: none; }
}

演示 HTML 结构

<div class="s d-dangerrow">
  <button class="d-btn d-btn--ghost" type="button">取消</button>
  <button class="d-dangerbtn" type="button">删除项目</button>
</div>

无障碍要点

  • 按钮文案写明后果(「删除项目」而不是「确定」),只听文字的读屏用户也能判断风险。
  • #dc2626 与白字对比度约 4.8:1,悬停的 #b91c1c 约 6.5:1,都满足 SC 1.4.3 的 4.5:1。
  • 不要只靠红色表达危险(SC 1.4.1),文案或警示图标要同时说明。

常见问题

危险操作按钮的英文是什么?

危险操作按钮的英文是 Destructive Button。常见英文别名还包括 Destructive Action。

Destructive Button 的中文是什么?

Destructive Button 的中文是「危险操作按钮」。常见中文别名还包括 删除按钮、危险按钮。红色实心表示会删掉东西,左边一枚同样大小的取消,避免手滑就生效。

删除按钮放在取消的左边还是右边?

没有统一标准。macOS 和多数 Web 设计系统把确认动作放在最右、取消在它左边;Windows 传统上把确认放在前面、取消在右边。本条按「取消在左、危险在右」处理,关键是和产品里其他对话框保持一致,不要这里在左、那里在右。

确认删除用对话框还是「撤销」提示?

能恢复的删除(移到回收站、软删除)优先直接执行,再给一个几秒内可撤销的提示,打扰最少;真正不可恢复的操作(永久删除、注销账号)才用确认对话框,风险特别高时可以要求用户输入项目名称后才允许点击。

确认对话框打开时,焦点应该放在哪个按钮上?

放在最不具破坏性的按钮上,通常是「取消」。WAI-ARIA 创作实践指南的对话框模式建议:确认不可逆操作的对话框,初始焦点放在破坏性最小的元素上,避免用户习惯性按回车就把东西删了。

常见搭配

同一页面里经常和「危险操作按钮」一起出现的模式,可以收藏后用「组合收藏为整页提示词」一起交给 AI。

标签