carbon-icons
2
总安装量
2
周安装量
#65408
全站排名
安装命令
npx skills add https://github.com/corlab-tech/skills --skill carbon-icons
Agent 安装分布
amp
2
gemini-cli
2
github-copilot
2
codex
2
windsurf
2
kimi-cli
2
Skill 文档
Carbon Icons
Use @carbon/icons-react for all icons. Never create inline SVGs or extract icons from Figma.
Import & Usage
import { Search, ChevronDown, Close, View, ViewOff, Information, Add } from '@carbon/icons-react';
<Search size={20} />
<Close size={16} />
Icons render as inline SVGs with currentColor fill â they inherit the parent’s text color.
Sizing
| Size | Context | Pairs with |
|---|---|---|
16 |
Inputs, badges, compact buttons, inline indicators | text-body-md (14px) |
20 |
Default â buttons, form fields, nav items | text-body-lg (16px) |
24 |
Section headers, cards, medium emphasis | text-heading-mdâtext-heading-lg |
32 |
Hero sections, empty states, pictograms | text-heading-xl+ |
Keep icon size consistent within a component. Do not mix sizes arbitrarily.
Color
- Icons are monochromatic â always a single solid color
- Color comes from
currentColorâ set via Tailwind text color on parent or icon - Match icon color with adjacent text â never use a different color for the icon vs its label
- Must pass 4.5:1 contrast ratio (same rule as typography)
- Use semantic tokens:
text-icon,text-icon-hover,text-icon-disabled,text-text,text-gray-600, etc.
// â
Icon inherits parent color
<span className="text-gray-600 flex items-center gap-1">
<Search size={16} /> Search
</span>
// â WRONG â icon has different color than text
<span className="text-gray-600">
<Search size={16} className="text-primary-600" /> Search
</span>
Alignment
- Always center-align icons next to text:
items-center - Never baseline-align icons to text
// â
Correct
<div className="flex items-center gap-2">
<Information size={16} />
<span>Help text</span>
</div>
Touch Targets
Interactive icons need minimum 44px touch target. Add padding if the icon is smaller:
<button className="p-3 flex items-center justify-center" aria-label="Close">
<Close size={16} />
</button>
Icon Types (V-Shield Design System Labeling)
The Figma Design System (node 2377:25170) labels icons into 3 categories:
- “used” â Standard Carbon icons. Import from
@carbon/icons-react. - “custom” â Not in Carbon. Only these may use inline SVG or a custom component.
- “both” â Exists in Carbon but customized. Prefer Carbon version unless customization is essential.
Finding Icons
Browse: https://carbondesignsystem.com/elements/icons/library/
Import names use PascalCase. Examples:
chevron-downâChevronDownview/view-offâView/ViewOffcloseâClosecheckmarkâCheckmarkwarningâWarninginformationâInformationaddâAddsubtractâSubtracteditâEdittrash-canâTrashCanoverflow-menu-verticalâOverflowMenuVertical
Pictograms & Flags
- Large illustrative icons (32px+): use
@carbon/pictograms-react - Country flags: custom assets (not in Carbon)
Rules Summary
- Always import from
@carbon/icons-react - Never create
<svg>manually for standard UI icons - Never extract SVGs from Figma
- Use
currentColorâ set color via Tailwind text classes - Center-align next to text (
items-center) - 44px minimum touch target for interactive icons
- Match icon color with adjacent text color