본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

아이콘 (Icons)

원문 보기 위키 갱신

PrimeIcons는 PrimeTek이 개발한 250개가 넘는 오픈소스 아이콘을 담은 PrimeVue 기본 아이콘 라이브러리예요. 템플릿 기능으로 어떤 아이콘이든 쓸 수 있기 때문에 PrimeIcons는 선택 사항이에요.

출처: 문서

본문

Icons

PrimeIcons is the default icon library of PrimeVue with over 250 open source icons developed by PrimeTek. PrimeIcons library is optional as PrimeVue components can use any icon with templating.

Basic

PrimeIcons는 pi pi-{icon} 형식의 문법을 사용해요. 예를 들어 pi pi-check 같은 식이죠. 독립된 아이콘은 i나 span 같은 요소로 표시할 수 있어요.

<i class="pi pi-check"></i>
<i class="pi pi-times"></i>
<span class="pi pi-search"></span>
<span class="pi pi-user"></span>

Color

아이콘 색은 color 프로퍼티로 정의하며, 기본적으로 부모로부터 상속받아요.

<i class="pi pi-check" style="color: slateblue"></i>
<i class="pi pi-times" style="color: green"></i>
<i class="pi pi-search" style="color: 'var(--p-primary-color)'"></i>
<i class="pi pi-user" style="color: #708090"></i>

Constants

Constants API를 사용하면 프로그래밍 방식으로 아이콘을 참조할 때 편리해요.

<template>
    <div class="card flex justify-center">
        <Menu :model="items" />
    </div>
</template>

<script>
import { PrimeIcons } from '@primevue/core/api';

export default {
    data() {
        return {
            items: [
                {
                    label: 'File',
                    items: [
                        { label: 'New', icon: PrimeIcons.PLUS },
                        { label: 'Open', icon: PrimeIcons.DOWNLOAD }
                    ]
                }
            ]
        };
    }
};
<\/script>

Download

PrimeIcons는 npm에서 받을 수 있어요. 다음 명령으로 프로젝트에 설치하세요.

npm install primeicons

Figma

PrimeIcons 라이브러리가 이제 Figma Community에서도 제공돼요. 라이브러리로 추가하면 디자인에서 이 아이콘들을 손쉽게 쓸 수 있어요.

Import

아이콘 라이브러리의 CSS 파일은 애플리케이션의 styles.scss에서 임포트해야 해요.

List

PrimeIcons의 전체 목록이 여기 있어요. 아이콘은 주기적으로 추가되며, 이슈 트래커에서 새 아이콘을 요청할 수도 있어요.

Size

아이콘 크기는 요소의 font-size 프로퍼티로 조절해요.

<i class="pi pi-check" style="font-size: 1rem"></i>
<i class="pi pi-times" style="font-size: 1.5rem"></i>
<i class="pi pi-search" style="font-size: 2rem"></i>
<i class="pi pi-user" style="font-size: 2.5rem"></i>

Spin

특별한 pi-spin 클래스는 아이콘에 무한 회전을 적용해요.

<i class="pi pi-spin pi-spinner" style="font-size: 2rem"></i>
<i class="pi pi-spin pi-cog" style="font-size: 2rem"></i>

더 알아보기 (Learn more)