BUTTON
图标按钮Icon Button
只有图标没有文字的方形按钮,省空间但必须配 tooltip 说明含义。
中英对照
- 中文
- 图标按钮
- 英文
- Icon Button
- 别名
- 图标操作钮、Icon-only Button
- 一句话
- 只有图标没有文字的方形按钮,省空间但必须配 tooltip 说明含义。
效果预览
常见变体
切换型图标按钮Toggle Icon Button
静音、收藏、置顶这类开关动作:按下后保持选中态,用 aria-pressed 表达状态,图标和名称不变。
适合用在哪
工具栏、卡片右上角操作区、表格行内操作、导航折叠。
不适合:页面的主操作和不可逆操作:「提交」「删除」只放一个图标,用户要先确认含义才敢点,这类按钮应该带文字;以触屏为主的产品也要谨慎,触屏没有悬停 tooltip,图标含义只能靠猜。
和相近模式的区别
图标文字按钮多了可见文字,可访问名称直接来自文字、不需要 tooltip,适合主操作;图标按钮只留图标,省空间但必须靠 aria-label 和 tooltip 说明,适合工具栏里高频、含义通用的操作(编辑、复制、更多)。
容易踩的坑
- 只放图标不加 aria-label,读屏只会念出「按钮」,用户无从得知功能。
- 28px 小尺寸直接用于移动端,点击热区远低于 44×44px,误触率很高。
- 用冷门或自造图标表达「归档」「同步」等抽象动作,没有 tooltip 时用户只能猜。
设计提示词 · Prompt
可复制 CSS
自包含的最小实现,粘贴到空白页面即可生效;类名可以按项目规范改名。
/* <button class="icon-btn" type="button" aria-label="编辑"><svg aria-hidden="true" viewBox="0 0 24 24">…</svg></button> */
.icon-btn {
position: relative;
display: inline-grid;
place-items: center;
width: 36px;
height: 36px;
padding: 0;
border: 1px solid #d1d5db;
border-radius: 8px;
background: #fff;
color: #4b5563;
cursor: pointer;
transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.icon-btn > svg { width: 20px; height: 20px; }
.icon-btn:hover { background: #f3f4f6; color: #111827; transform: scale(1.05); }
.icon-btn:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
.icon-btn--sm { width: 28px; height: 28px; }
.icon-btn--sm > svg { width: 16px; height: 16px; }
/* 28px 视觉尺寸,透明伪元素把点击热区扩到 44px */
.icon-btn--sm::before { content: ""; position: absolute; inset: -8px; }
.icon-btn--lg { width: 44px; height: 44px; border-radius: 10px; }
.icon-btn--lg > svg { width: 24px; height: 24px; }
.icon-btn--soft { border-color: transparent; background: #f3f4f6; }
.icon-btn--soft:hover { background: #e5e7eb; }
.icon-btn--solid { border-color: transparent; background: #111827; color: #fff; }
.icon-btn--solid:hover { background: #1f2937; color: #fff; }
.icon-btn--ghost { border-color: transparent; background: transparent; }
.icon-btn[aria-pressed="true"] { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
@media (prefers-reduced-motion: reduce) {
.icon-btn { transition: none; }
.icon-btn:hover { transform: none; }
}
演示 HTML 结构
<div class="s d-iconrow"> <button class="d-iconbtn2" type="button">✎</button> <button class="d-iconbtn2 d-iconbtn2--soft" type="button">⧉</button> <button class="d-iconbtn2 d-iconbtn2--gd" type="button">+</button> <button class="d-iconbtn2" type="button">⋯</button> </div>
无障碍要点
- 图标 SVG 加 aria-hidden="true",名称只写在按钮的 aria-label 上,避免读屏把图标内容也念出来。
- 开关类图标按钮用 aria-pressed 表示状态,aria-label 保持动作名不变;状态和名称同时变会让读屏用户分不清当前是开还是关。
- 小尺寸按钮之间要留间距,扩出来的点击热区不要互相重叠。
常见问题
图标按钮的英文是什么?
图标按钮的英文是 Icon Button。常见英文别名还包括 Icon-only Button。
Icon Button 的中文是什么?
Icon Button 的中文是「图标按钮」。常见中文别名还包括 图标操作钮。只有图标没有文字的方形按钮,省空间但必须配 tooltip 说明含义。
图标按钮最小要做多大?
WCAG 2.2 的 SC 2.5.8(AA 级)要求点击目标至少 24×24 CSS px,或者与相邻目标留出足够间距;SC 2.5.5(AAA 级)要求 44×44。移动端建议按 44px 做,视觉上想更小,可以像本条 --sm 一样用透明伪元素把热区外扩,伪元素也属于按钮本身的命中区域。
tooltip 直接用 title 属性可以吗?
不推荐只靠 title。title 只在鼠标悬停一段时间后出现,键盘聚焦和触屏时都看不到,读屏软件对它的处理也不一致。可访问名称用 aria-label,再做一个悬停和聚焦都会出现、按 Esc 能关闭的自定义 tooltip(对应 SC 1.4.13 悬停或聚焦时出现的内容)。
图标用 SVG 还是图标字体?
优先用内联 SVG。图标字体加载失败时会显示成方框或乱码,用户自定义字体时可能被替换,有些读屏还会读出私有区字符;SVG 用 currentColor 跟随文字颜色,尺寸和描边都更可控。
常见搭配
同一页面里经常和「图标按钮」一起出现的模式,可以收藏后用「组合收藏为整页提示词」一起交给 AI。
所属设计风格
「图标按钮」是这些整体设计风格的常见组成部分,在设计风格词典里可以看到整页效果。