# CircleProgress 진행률 링
링형 진행 표시: svg 이중 circle(트랙 + 진행 호)로 백분율을 표현하며, 완전 제어 방식, 내부 상태 없음,
이벤트 없음입니다. 기하학 변환(반지름 / 둘레 / dasharray / 시작 회전각)과 색상 정규화는 모두
@lh-ui/share/core/circle-progress 순수 로직에 있고, 이 컴포넌트는 반응형 접착과 템플릿만 담당합니다.
modelValue는 0-100의 제어 백분율이며, 범위 초과는 share core가 클램프(clampPercent)합니다;
startAngle은 12시 방향을 0도로 하고 시계 방향을 양수로 합니다(시침과 일치), clockwise=false
일 때 svg에 scaleX(-1)을 추가해 스캔 방향을 뒤집습니다.
<template>
<div class="demo-col" style="gap: 18px; flex-wrap: wrap; flex-direction: row; align-items: flex-start">
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" />
<span class="demo-note">기본 (제어 percent={{ percent }})</span>
</div>
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" :size="80" :stroke-width="4" />
<span class="demo-note">size=80 strokeWidth=4</span>
</div>
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" color="#A63D40" track-color="#EDE8E0" />
<span class="demo-note">단색 + trackColor</span>
</div>
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" :color="['#2B4C7C', '#3A7D5A']" />
<span class="demo-note">2색 그라데이션</span>
</div>
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" :clockwise="false" :start-angle="90" />
<span class="demo-note">반시계 방향 + 시작 3시 방향</span>
</div>
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" :show-text="false" linecap="butt" />
<span class="demo-note">텍스트 없음 + linecap=butt</span>
</div>
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" :format="format" label="디지털 진행률" />
<span class="demo-note">format 사용자 정의 텍스트</span>
</div>
<div class="demo-col" style="align-items: center; gap: 8px">
<LhCircleProgress :model-value="percent" label="수집 진행률">
<span style="font-size: 12px">{{ percent }}/100</span>
</LhCircleProgress>
<span class="demo-note">기본 슬롯으로 텍스트 덮어쓰기</span>
</div>
<div class="demo-row" style="gap: 12px; align-items: center">
<LhButton size="small" @click="dec">-10</LhButton>
<LhButton size="small" @click="inc">+10</LhButton>
</div>
</div>
</template>
<script>
export default {
data: () => ({
percent: 65,
}),
methods: {
format(v) {
return `${v}% 완료`
},
inc() {
this.percent = Math.min(this.percent + 10, 130)
},
dec() {
this.percent = Math.max(this.percent - 10, -20)
},
},
}
</script>
# 크기와 테두리
size는 링 지름(px), strokeWidth는 테두리 두께(px)입니다; 반지름은
(size - strokeWidth) / 2를 취하며, 테두리가 뷰포트를 벗어나지 않습니다:
<LhCircleProgress :model-value="70" :size="80" :stroke-width="4" />
# 색상
color는 단색 문자열과 그라데이션 색상 배열을 지원합니다 (배열 항목이 2개 이상일 때 defs > linearGradient로
렌더링, 동일 간격 오프셋으로 끝점 배치); trackColor가 트랙 색상을 덮어씁니다. 둘 다 미전달 시
lh-circle-progress의 토큰 폴백(--lh-primary-color / 트랙 회색)을 따릅니다:
<LhCircleProgress :model-value="70" color="#A63D40" track-color="#EDE8E0" />
<LhCircleProgress :model-value="70" :color="['#2B4C7C', '#3A7D5A']" />
# 방향과 시작각
startAngle(도, 0 = 12시 방향, 시계 방향 양수)이 시작 위치를 결정하며, 내부적으로 svg
rotate 변환으로 환산됩니다(SVG circle은 기본적으로 3시 방향에서 시작); clockwise=false이면
scaleX(-1)을 추가해 전체를 뒤집습니다:
<LhCircleProgress :model-value="70" :clockwise="false" :start-angle="90" />
# 끝점 모양과 텍스트
linecap은 butt / round / square를 취합니다 (기본 round). showText=false
일 때 루트에 --no-text 수정자를 추가하고 링 내부 텍스트를 숨깁니다; format이 기본 텍스트를
사용자 정의합니다(입력 매개변수는 클램프된 백분율); 기본 슬롯이 전체 텍스트를 덮어씁니다:
<LhCircleProgress :model-value="70" :format="(v) => `${v}% 완료`" />
<LhCircleProgress :model-value="70" label="수집 진행률">
<span style="font-size: 12px;">70/100</span>
</LhCircleProgress>
# Props
| 프로퍼티 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| modelValue | 진행 백분율 0-100 (제어; 범위 초과 시 클램프) | number | 0 |
| size | 링 크기 px (지름) | number | 120 |
| strokeWidth | 테두리 두께 px | number | 6 |
| color | 진행 색상: 단색 문자열 또는 그라데이션 색상 배열 (배열 항목 2개 이상을 linearGradient 끝점으로 사용) | string \| string[] | — |
| trackColor | 트랙 색상 (미전달 시 토큰 폴백) | string | — |
| clockwise | 시계 방향 (false일 때 svg에 scaleX(-1) 추가) | boolean | true |
| startAngle | 시작 각도 (도, 0 = 12시 방향, 시계 방향 양수) | number | 0 |
| showText | 기본 백분율 텍스트 표시 | boolean | true |
| format | 텍스트 포맷 (입력 매개변수는 클램프된 백분율, 기본은 정수 퍼센트 기호) | (percentage: number) => string | — |
| linecap | 테두리 끝점 모양 | 'butt' \| 'round' \| 'square' | 'round' |
| label | 접근성 접근 가능한 이름 (aria-label) | string | — |
| sx | sx 레이아웃 단축 속성 | LhSxProps | — |
# Slots
| 슬롯 | 설명 | 스코프 매개변수 |
|---|---|---|
| default | 링 내부 기본 텍스트 덮어쓰기 (기본: formatCircleText 결과 렌더링) | — |
# 접근성
루트 요소는 getCircleProgressAria가 role="progressbar",
aria-valuemin="0", aria-valuemax="100", aria-valuenow(클램프된 백분율)를 주입합니다;
label이 접근 가능한 이름을 제공합니다 (보이는 텍스트가 없을 때 필수).
Copyright © 2024-2026 FengMo WenXue