ナビゲーション

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か月あたり、1席あたり、1,000リクエストあたりなどの課金単位を示します。小さく控えめに表示し、数字のベースラインに揃えます。「/mo」のような略記は「スラッシュ、mo」と読み上げられるため、省略せず言葉で記述してください。
  • price-wasは、現在は適用されない価格です。現在の金額の前に控えめに表示し、取り消し線を付けます。記載内容がすでに正しくないことを示すため、<s>を使います。

旧価格、通貨記号、金額、課金単位の順に、読み上げる順序で記述します。通貨記号を数字の後ろに置く場合は、price-currencyをprice-amountの後に記述します。

#サイズ

数字の既定サイズは36pxです。行内や小さなカードには24pxのprice-sm、ページの主役となる価格には56pxのprice-lgを使います。各要素のサイズは数字を基準に決まるため、--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を使います。

#アクセシビリティ

  • 各要素は、記述した順に「ドル、29、月あたり」のように読み上げられます。通貨記号は必ずテキストで記述し、背景画像は使わないでください。
  • スクリーンリーダーによっては、旧価格に取り消し線が付いていることを読み上げません。新旧の区別が重要な場合は、旧価格の前に「以前の価格」、現在の金額の前に「現在の価格」など、画面には表示しない読み上げ用の文言を追加してください。
  • おすすめのプランは、数字の大きさだけで示さず、カード内の文言で明示してください。

#クラス

クラス説明
price1行で表示する価格。36pxの等幅数字を詰めて配置します。
price-sm24pxの数字。既定は36pxprice と併用します
price-lg56pxの数字。ページの主題となる単一の価格向け。既定は36pxprice と併用します
price-amount数字、または「無料」などの文言。
price-currency通貨記号。数字の半分未満のサイズで、数字の上端に揃えます。
price-period「月あたり」「1席あたり」などの単位を、小さく控えめな色でベースラインに揃えて表示
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);  }}