부품 본문 구역
숫자 띠 stat-band
실적·규모를 큰 숫자 3–5개로 보여 주는 띠. 숫자는 테마의 제목 글꼴로 크게, 단위는 작게 붙이고 굵은 선으로 칸을 나눈다. 모바일은 두 칸씩.
설치
shadcn/ui 를 쓰는 Next.js 프로젝트에서 한 줄로 설치됩니다. 파일은 components/bpublish/stat-band.tsx 로 들어오고, 공통 토큰(base)도 같이 설치됩니다. 테마는 테마에서 하나 고릅니다.
npx shadcn@latest add https://www.bpublish.com/r/stat-band.json레지스트리를 등록했다면 npx shadcn@latest add @bpublish/stat-band · 설치 안내
AI에게 맡기기
Claude Code, Cursor 같은 AI 코딩 도구에 붙여 넣으세요. MCP 서버를 연결해 두면 이름만 말해도 됩니다.
bpublish UI의 숫자 띠(stat-band) 부품으로 만들어 줘. 설치: npx shadcn@latest add https://www.bpublish.com/r/stat-band.json · 문서: https://www.bpublish.com/designs/components/stat-band사용 예시
import { StatBand } from '@/components/bpublish/stat-band'
export default function Example() {
return (
<>
<StatBand
title="2026학년도 입시 결과"
footnote="6개월 이상 수강한 재원생 기준 자체 집계 · 2026년 2월 28일 마감"
items={[
{ value: '14', unit: '명', label: '의·치·한·약 합격', note: '수시 6 · 정시 8' },
{ value: '41', unit: '%', label: '수능 수학 1등급 비율', note: '고3·N수 재원생 87명 중 36명' },
{ value: '98', unit: '명', label: '주요 대학 합격', note: '서울대 11 · 연세대 17 · 고려대 19 외' },
{ value: '8', unit: '명', label: '한 반 정원 상한', note: '2011년 개원 때부터 지킨 원칙' },
]}
/>
<StatBand
tone="plain"
items={[
{ value: '14', unit: '명', label: '2026 의·치·한·약' },
{ value: '11', unit: '명', label: '2026 서울대' },
{ value: '41', unit: '%', label: '2026 수능 수학 1등급' },
]}
/>
</>
)
}속성
| 이름 | 형식 | 기본값 | 설명 |
|---|---|---|---|
items필수 | { value: string; unit?: string; label: string; note?: string }[] | — | 숫자 3–5개. value 는 글자로 받는다('1:1' 도 된다) |
title | string | — | 띠 맨 위 제목 |
footnote | string | — | 제목 오른쪽의 집계 기준·출처 |
tone | 'primary' | 'plain' | 'primary' | primary: 강조색 띠 / plain: 바탕색 그대로 |
원본 코드
설치 명령 없이 그대로 복사해 넣어도 됩니다. React 외의 패키지는 쓰지 않습니다.
/**
* bpublish UI — 숫자 띠. https://www.bpublish.com/designs/components/stat-band
* 실적·규모를 큰 숫자 3–5개로 보여 주는 띠. 숫자는 테마의 제목 글꼴, 단위는 작게, 굵은 선으로 칸을 나눈다.
*/
export type StatItem = {
/** 숫자. '14' '41' '1:1' 처럼 글자로 받는다 */
value: string
/** 단위. 숫자 오른쪽 아래에 작게 붙는다 ('명' '%') */
unit?: string
/** 숫자 이름 */
label: string
/** 이름 아래 한 줄 보충 */
note?: string
}
export type StatBandProps = {
items: StatItem[]
/** 띠 맨 위 제목 ('2026학년도 입시 결과') */
title?: string
/** 제목 오른쪽 출처·기준 */
footnote?: string
/** primary: 강조색 띠 / plain: 바탕색 그대로 */
tone?: 'primary' | 'plain'
className?: string
}
const lgCols: Record<number, string> = { 3: 'lg:grid-cols-3', 4: 'lg:grid-cols-4', 5: 'lg:grid-cols-5' }
export function StatBand({ items, title, footnote, tone = 'primary', className = '' }: StatBandProps) {
const n = items.length
const big = n >= 5 ? 'text-[64px] md:text-[96px]' : 'text-[72px] md:text-[128px]'
const unit = n >= 5 ? 'text-xl md:mb-2 md:text-[26px]' : 'text-[22px] md:mb-3 md:text-[34px]'
return (
<section className={`${tone === 'primary' ? 'bg-primary text-primary-foreground' : 'bg-background text-foreground'} ${className}`}>
<div className="shell py-12 md:py-16">
{title || footnote ? (
<div className="flex flex-col gap-2 border-b-[3px] border-current pb-4 md:flex-row md:items-end md:justify-between md:gap-8">
{title ? <h2 className="text-xl font-semibold md:text-2xl">{title}</h2> : null}
{footnote ? <p className="text-[13px] font-medium opacity-80 md:text-sm">{footnote}</p> : null}
</div>
) : null}
<dl className={`grid grid-cols-2 ${lgCols[n] ?? 'lg:grid-cols-4'}`}>
{items.map((item, i) => (
<div
key={item.label}
className={`flex flex-col pt-8 pr-3 pb-2 lg:px-8 ${i % 2 === 1 ? 'border-l-[3px] border-current pl-4' : ''} ${
i > 0 ? 'lg:border-l-[3px] lg:border-current' : 'lg:pl-0'
} ${i > 1 ? 'border-t-[3px] border-current lg:border-t-0' : ''} ${
n % 2 === 1 && i === n - 1 ? 'col-span-2 lg:col-span-1' : ''
}`}
>
<dt className="order-2 mt-4 text-base font-semibold md:text-[19px]">{item.label}</dt>
<dd className="order-1 flex items-end">
<span className={`heading leading-[0.9] tabular-nums ${big}`}>{item.value}</span>
{item.unit ? <span className={`mb-1 ml-1 font-semibold ${unit}`}>{item.unit}</span> : null}
</dd>
{item.note ? <dd className="order-3 mt-1 text-[13px] leading-snug font-medium opacity-80 md:text-sm">{item.note}</dd> : null}
</div>
))}
</dl>
</div>
</section>
)
}