탐색

v2.1.0
데이터 표시

가격

금액과 통화 기호, 요금 단위를 읽기 쉽게 표시하는 컴포넌트입니다.

이 페이지의 내용

가격 컴포넌트는 금액을 읽기 쉽게 표시합니다. 숫자는 크게, 통화 기호는 작게 표시해 숫자의 윗선에 맞추고, 요금 단위는 눈에 덜 띄게 숫자의 기준선에 맞춥니다. 가격 컴포넌트에는 자체 배경이 없습니다. 요금제 카드 안이나 상품 옆, 청구서 하단에 배치하세요.

가격

<div class="tray flex flex-wrap gap(4) max-w(480) mx-auto">  <div class="card card-flat grow(1) basis(200)">    <div class="card-header">      <h3 class="card-title">Starter</h3>      <p class="card-description">For one person and a few projects.</p>    </div>    <p class="price">      <span class="price-currency">$</span><span class="price-amount">9</span><span class="price-period">per month</span>    </p>    <div class="card-footer"><button class="btn" type="button">Choose Starter</button></div>  </div>  <div class="card card-flat grow(1) basis(200)">    <div class="card-header">      <h3 class="card-title">Team</h3>      <p class="card-description">For a team that ships every day.</p>    </div>    <p class="price">      <s class="price-was"><span class="sr-only">Was</span>$39</s><span class="sr-only">now</span><span class="price-currency">$</span><span class="price-amount">29</span><span class="price-period">per month</span>    </p>    <div class="card-footer">      <button class="btn btn-primary" type="button">Choose Team</button>    </div>  </div></div>
<div className="tray flex flex-wrap gap(4) max-w(480) mx-auto">  <div className="card card-flat grow(1) basis(200)">    <div className="card-header">      <h3 className="card-title">Starter</h3>      <p className="card-description">For one person and a few projects.</p>    </div>    <p className="price">      <span className="price-currency">$</span><span className="price-amount">9</span><span className="price-period">per month</span>    </p>    <div className="card-footer"><button className="btn" type="button">Choose Starter</button></div>  </div>  <div className="card card-flat grow(1) basis(200)">    <div className="card-header">      <h3 className="card-title">Team</h3>      <p className="card-description">For a team that ships every day.</p>    </div>    <p className="price">      <s className="price-was"><span className="sr-only">Was</span>$39</s><span className="sr-only">now</span><span className="price-currency">$</span><span className="price-amount">29</span><span className="price-period">per month</span>    </p>    <div className="card-footer">      <button className="btn btn-primary" type="button">Choose Team</button>    </div>  </div></div>
<div class="tray flex flex-wrap gap(4) max-w(480) mx-auto">  <div class="card card-flat grow(1) basis(200)">    <div class="card-header">      <h3 class="card-title">Starter</h3>      <p class="card-description">For one person and a few projects.</p>    </div>    <p class="price">      <span class="price-currency">$</span><span class="price-amount">9</span><span class="price-period">per month</span>    </p>    <div class="card-footer"><button class="btn" type="button">Choose Starter</button></div>  </div>  <div class="card card-flat grow(1) basis(200)">    <div class="card-header">      <h3 class="card-title">Team</h3>      <p class="card-description">For a team that ships every day.</p>    </div>    <p class="price">      <s class="price-was"><span class="sr-only">Was</span>$39</s><span class="sr-only">now</span><span class="price-currency">$</span><span class="price-amount">29</span><span class="price-period">per month</span>    </p>    <div class="card-footer">      <button class="btn btn-primary" type="button">Choose Team</button>    </div>  </div></div>
<template>  <div class="tray flex flex-wrap gap(4) max-w(480) mx-auto">    <div class="card card-flat grow(1) basis(200)">      <div class="card-header">        <h3 class="card-title">Starter</h3>        <p class="card-description">For one person and a few projects.</p>      </div>      <p class="price">        <span class="price-currency">$</span><span class="price-amount">9</span><span class="price-period">per month</span>      </p>      <div class="card-footer"><button class="btn" type="button">Choose Starter</button></div>    </div>    <div class="card card-flat grow(1) basis(200)">      <div class="card-header">        <h3 class="card-title">Team</h3>        <p class="card-description">For a team that ships every day.</p>      </div>      <p class="price">        <s class="price-was"><span class="sr-only">Was</span>$39</s><span class="sr-only">now</span><span class="price-currency">$</span><span class="price-amount">29</span><span class="price-period">per month</span>      </p>      <div class="card-footer">        <button class="btn btn-primary" type="button">Choose Team</button>      </div>    </div>  </div></template>

#구성 요소

  • price-amount는 금액을 나타냅니다. 모든 숫자에 같은 폭을 적용하고 숫자 사이 간격을 좁게 표시합니다. ‘무료’나 ‘맞춤’ 같은 단어도 쓸 수 있습니다.
  • price-currency는 통화 기호입니다. 크기는 숫자의 절반보다 작고 윗선은 숫자와 같아서, 금액의 일부로 읽히면서도 숫자보다 두드러지지 않습니다.
  • price-period은 월, 사용자 한 명, 요청 1,000건 등 요금이 적용되는 단위를 나타냅니다. 작고 눈에 덜 띄게 표시하며 숫자의 기준선에 맞춥니다. 단위는 단어로 풀어 쓰세요. 영어 표기 ‘/mo’는 음성으로 읽을 때 ‘슬래시 모’로 들립니다.
  • price-was는 더 이상 적용되지 않는 이전 가격입니다. 현재 금액 앞에 눈에 덜 띄게 표시하고 취소선을 긋습니다. 이 텍스트가 더 이상 유효하지 않다는 의미를 전달하는 <s> 요소를 사용하세요.

읽는 순서에 맞춰 이전 가격, 통화 기호, 금액, 요금 단위 순으로 작성하세요. 통화 기호가 숫자 뒤에 오는 경우에는 price-amount 뒤에 price-currency를 배치하세요.

#크기

기본 숫자 크기는 36px입니다. price-sm은 행이나 작은 카드에 쓰는 24px 크기이고, price-lg는 가격 하나가 페이지의 중심일 때 쓰는 56px 크기입니다. 각 부분의 크기는 숫자 크기에 비례하므로, --price-size를 사용하면 가격 표시 전체를 그 사이의 원하는 크기로 조절할 수 있습니다.

크기

<p class="price price-sm">  <span class="price-currency">$</span><span class="price-amount">9</span><span class="price-period">per month</span></p><p class="price">  <span class="price-currency">$</span><span class="price-amount">29</span><span class="price-period">per month</span></p><p class="price price-lg">  <span class="price-currency">€</span><span class="price-amount">1,240</span><span class="price-period">per seat</span></p>
<>  <p className="price price-sm">    <span className="price-currency">$</span><span className="price-amount">9</span><span className="price-period">per month</span>  </p>  <p className="price">    <span className="price-currency">$</span><span className="price-amount">29</span><span className="price-period">per month</span>  </p>  <p className="price price-lg">    <span className="price-currency">€</span><span className="price-amount">1,240</span><span className="price-period">per seat</span>  </p></>
<p class="price price-sm">  <span class="price-currency">$</span><span class="price-amount">9</span><span class="price-period">per month</span></p><p class="price">  <span class="price-currency">$</span><span class="price-amount">29</span><span class="price-period">per month</span></p><p class="price price-lg">  <span class="price-currency">€</span><span class="price-amount">1,240</span><span class="price-period">per seat</span></p>
<template>  <p class="price price-sm">    <span class="price-currency">$</span><span class="price-amount">9</span><span class="price-period">per month</span>  </p>  <p class="price">    <span class="price-currency">$</span><span class="price-amount">29</span><span class="price-period">per month</span>  </p>  <p class="price price-lg">    <span class="price-currency">€</span><span class="price-amount">1,240</span><span class="price-period">per seat</span>  </p></template>

#가격과 지표

가격은 지불할지 판단할 때 고려하는 비용입니다. 이번 달 매출처럼 레이블과 변화량이 붙는 측정값에는 지표를 사용하세요. 금액이 여러 셀 중 하나에 들어가는 값이라면 표에서 table-numeric을 사용하세요.

#접근성

  • 각 부분은 마크업에 작성한 순서대로 읽힙니다. 예를 들어 영어에서는 ‘dollar 29 per month’ 순서로 읽힙니다. 통화 기호는 반드시 텍스트로 작성하세요. 배경 이미지로 넣으면 안 됩니다.
  • 스크린 리더에 따라 가격에 취소선이 있다는 사실을 읽어 주지 않을 수 있습니다. 이전 가격과 현재 가격의 차이를 알리는 것이 중요하다면, 이전 가격 앞에 ‘기존’, 현재 금액 앞에 ‘현재’처럼 화면에는 보이지 않는 짧은 문구를 추가하세요.
  • 추천 요금제를 숫자 크기만으로 구분하지 말고 카드 안에 추천 여부를 명시하세요.

#클래스

클래스설명
price가격은 한 줄에 표시하며, 너비가 일정한 36px 숫자를 촘촘하게 배치합니다.
price-sm24px 숫자입니다. 기본값은 36px입니다.적용할 클래스는 price입니다
price-lg페이지에서 중점적으로 보여 주는 단 하나의 가격에 쓰는 56px 숫자입니다. 기본값은 36px입니다.적용할 클래스는 price입니다
price-amount금액 또는 ‘무료’와 같은 문구
price-currency숫자 크기의 절반보다 작고 숫자 위쪽에 맞춰 정렬되는 통화 기호
price-period월, 좌석 등 가격의 기준 단위를 기준선에 맞춰 작고 낮은 대비로 표시합니다
price-was이전 가격은 현재 금액 앞에 차분한 색과 취소선으로 표시합니다.

#사용자 지정 속성

속성기본값설명
--price-size2.25rem숫자 크기. 나머지 요소의 크기도 이 값에 맞춰 조정됩니다.

#소스

@master/ui/components/price.css
/* * Price: what something costs, set the way a price is read. * The amount is large, in tabular figures with a tight fit. The currency mark is small and hangs from the * top of the figures, level with their cap height; the period is small and quiet on their baseline. A price * that no longer holds stands before the amount, struck through, on a <s>. * Everything is sized from the amount, so one size class or one font-size scales the whole price. */@layer components.ui {  .price {    --price-size: 2.25rem;    display: inline-flex;    align-items: baseline;    min-width: 0;    margin: 0;    color: var(--color-text-strong);    font: var(--font-weight-control) var(--price-size)/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    letter-spacing: -.03em;    white-space: nowrap;    &.price-sm {      --price-size: 1.5rem;    }    &.price-lg {      --price-size: 3.5rem;      letter-spacing: -.04em;    }  }  /* The figures. */  .price-amount {    font: inherit;  }  /* The currency mark: under half the size of the figures, its top level with theirs. */  .price-currency {    align-self: flex-start;    margin-block-start: .16em;    margin-inline-end: .14em;    color: var(--color-text-body);    font-size: .46em;    letter-spacing: 0;    line-height: 1;  }  /* Per what: a month, a seat, a thousand requests. */  .price-period {    margin-inline-start: .3em;    color: var(--color-text-muted);    font-weight: 400;    font-size: max(.8125rem, .36em);    letter-spacing: 0;  }  /* The price that no longer holds: quiet, struck, before the one that does. */  .price-was {    margin-inline-end: .5em;    color: var(--color-text-muted);    font-weight: 400;    font-size: .5em;    letter-spacing: -.01em;    text-decoration-line: line-through;    /* The strike grows with the figures it crosses. */    text-decoration-thickness: max(1px, .07em);    text-decoration-color: var(--color-line-mark);  }}