Svg Icon Pattern
Standards for creating and using SVG icons. Use SvgProps from @lib/ui/props and spread them on the svg element. Size icons via fontSize in the style prop at…
от vultisig★ 22 звезды на GitHub
Установить Svg Icon Pattern в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
SVG Icon Pattern
Instructions
When creating or updating icons in the lib/ui/icons directory, follow these standards to ensure consistency and flexibility.
1. Icon Component Definition
Export a named component that receives SvgProps from @lib/ui/props. Spread these props onto the svg element.
// ✅ Good: SvgProps pattern
import { SvgProps } from '@lib/ui/props'
export const MyIcon = (props: SvgProps) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 24 24"
fill="currentColor"
{...props}
>
<path d="..." />
</svg>
)
// ❌ Bad: IconWrapper inside icon definition
export const MyIcon = (props: any) => (
<IconWrapper {...props}>
<svg>...</svg>
</IconWrapper>
)
2. Sizing and Dimensions
- Calculate dimensions based on the
viewBoxattribute. - The largest dimension (width or height) should always be
1em. - The smaller dimension should be calculated proportionally:
(smaller / larger)em. - Neither width nor height should exceed
1em.
// Example for non-square icon (viewBox="0 0 22 20")
// height = 20/22 = 0.909
<svg width="1em" height="0.909em" viewBox="0 0 22 20" ...>
3. Styling and Colors
- Use
fill="currentColor"orstroke="currentColor"to allow the icon to inherit colors from its parent. - For multi-colored icons, use specific colors only where necessary.
4. Usage and Sizing
Size icons at the usage site using the fontSize property within the style prop. This leverages the 1em base size defined in the icon component.
// ✅ Good: Direct sizing via style
<MyIcon style={{ fontSize: 24 }} />
// ❌ Bad: Using size prop (requires IconWrapper)
<MyIcon size={24} />
Anti-Patterns to Avoid
- DO NOT wrap icons with
IconWrapperinside the icon component file. - DO NOT use hardcoded pixel values for
widthandheightin thesvgelement. - DO NOT use
IconWrapperat the usage site if simplefontSizestyling is sufficient.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Svg Icon Pattern?
Standards for creating and using SVG icons. Use SvgProps from @lib/ui/props and spread them on the svg element. Size icons via fontSize in the style prop at the usage site.
Как установить скилл Svg Icon Pattern?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Svg Icon Pattern запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…