Icon
Lucide 아이콘을 래핑하고 표준화된 크기와 스타일링으로 사용자 정의 SVG 아이콘을 지원하는 유연한 아이콘 컴포넌트입니다.
예제
사용 방법
아이콘을 지정하려면 name 속성을 사용하고 사용자 정의 스타일링에는 class 클래스를 사용합니다.
기본 사용법
astro
---
import Icon from '@/components/general/Icon.astro';
---
<Icon name="Star" /> 스타일 지정
astro
---
import Icon from '@/components/general/Icon.astro';
---
<Icon name="CircleAlert" class="w-8 h-8 text-red-500" /> 투톤 및 다채로운
유틸리티 클래스를 사용하여 색상을 지정하여 다채로운 아이콘을 렌더링합니다.
astro
---
import Icon from '@/components/general/Icon.astro';
---
<Icon name="Smile" class="w-8 h-8 text-blue-500" />
<Icon name="Heart" class="w-8 h-8 text-red-500" />
<Icon name="CircleCheck" class="w-8 h-8 text-green-500" /> 사용자 정의 아이콘
사용자 정의 SVG 아이콘을 사용하려면 public/icons 디렉토리에 배치하십시오.
astro
---
import Icon from '@/components/general/Icon.astro';
---
<Icon name="astro.svg" size="32" /> API 참조
| 속성 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| name | Lucide 아이콘 이름 또는 사용자 정의 SVG 파일 이름 (예: custom.svg) | string | - |
| size | 아이콘의 크기 (너비 및 높이) | number | string | 24 |
| color | 아이콘 색상 (일반적으로 currentColor) | string | 'currentColor' |
| strokeWidth | 아이콘의 선 두께 (Lucide 아이콘용) | number | string | 2 |
| class | 사용자 정의 스타일링을 위한 추가 CSS 클래스 | string | - |