ナビゲーション

v2.1.0
質感

サーフェス

トレイ、シート、ウェル。すべてのコンポーネントの土台となる、奥行きの異なる素材です。

このページの内容

Master UI のコンポーネントは、すべて少数の共通素材で作られています。カード、パネル、グループにこれらを直接使うと、カスタムレイアウトでもコンポーネントと光や奥行きの表現を揃えられます。素材の奥行きの段階については、テーマを参照してください。

トレイ、シート、ウェル

<div class="tray">  <div class="sheet flex flex-col gap-md p-lg">    <p class="m(0) text-sm fg-text-strong">Deployment</p>    <div class="well p-md text-sm fg-text-muted">No builds are queued.</div>  </div></div>
<div className="tray">  <div className="sheet flex flex-col gap-md p-lg">    <p className="m(0) text-sm fg-text-strong">Deployment</p>    <div className="well p-md text-sm fg-text-muted">No builds are queued.</div>  </div></div>
<div class="tray">  <div class="sheet flex flex-col gap-md p-lg">    <p class="m(0) text-sm fg-text-strong">Deployment</p>    <div class="well p-md text-sm fg-text-muted">No builds are queued.</div>  </div></div>
<template>  <div class="tray">    <div class="sheet flex flex-col gap-md p-lg">      <p class="m(0) text-sm fg-text-strong">Deployment</p>      <div class="well p-md text-sm fg-text-muted">No builds are queued.</div>    </div>  </div></template>

#シート

シートは、角の半径が 16px の浮き上がった面です。対応ブラウザーでは、角をスクワークルとして描画します。上端に光が当たり、0.5px の輪郭が付き、下には短くフェードする影が落ちます。既定では浮き上がった表示になり、用途に応じて浮き上がりの段階を選べます。

シートの浮き上がり

<div class="sheet sheet-flat p-lg text-sm fg-text-muted">Flat</div><div class="sheet sheet-raised p-lg text-sm fg-text-muted">Raised</div><div class="sheet p-lg text-sm fg-text-muted">Lifted</div><div class="sheet sheet-floating p-lg text-sm fg-text-muted">Floating</div>
<>  <div className="sheet sheet-flat p-lg text-sm fg-text-muted">Flat</div>  <div className="sheet sheet-raised p-lg text-sm fg-text-muted">Raised</div>  <div className="sheet p-lg text-sm fg-text-muted">Lifted</div>  <div className="sheet sheet-floating p-lg text-sm fg-text-muted">Floating</div></>
<div class="sheet sheet-flat p-lg text-sm fg-text-muted">Flat</div><div class="sheet sheet-raised p-lg text-sm fg-text-muted">Raised</div><div class="sheet p-lg text-sm fg-text-muted">Lifted</div><div class="sheet sheet-floating p-lg text-sm fg-text-muted">Floating</div>
<template>  <div class="sheet sheet-flat p-lg text-sm fg-text-muted">Flat</div>  <div class="sheet sheet-raised p-lg text-sm fg-text-muted">Raised</div>  <div class="sheet p-lg text-sm fg-text-muted">Lifted</div>  <div class="sheet sheet-floating p-lg text-sm fg-text-muted">Floating</div></template>
クラス浮き上がり用途
sheet sheet-flat輪郭のみ、影なし情報密度の高いリストやテーブル
sheet sheet-raised--shadow-raised要素の多いサーフェス上の小さなカード
sheet--shadow-liftedカードやパネル
sheet sheet-floating--shadow-floatingコンテンツに重なるポップオーバーやメニュー
sheet sheet-inverseインク色の面に、浮き上がったシートと同じ影ページ内で行動を促す 1 つのサーフェス

#反転

sheet-inverse はインク色のシートです。moonstone では暗色、obsidian ではパール色になります。プライマリーボタンの面をサーフェスの大きさにしたもので、光の当たり方や上端のハイライトも共通です。行動喚起など、ユーザーに行動を促す箇所に、1 ページにつき 1 つ使います。

この面のテキストには反転したインク色を使います。見出しには既定で強いインク色が使われるため、fg-text-inverse を追加します。この面に置いた既定のボタンは、見えている要素の中で最も明るく、操作箇所として目立ちます。プライマリーボタンでは、面もボタンもインク色になります。

反転

<section class="sheet sheet-inverse flex flex-wrap items-center justify-between gap-md p-lg">  <div class="flex flex-col gap-3xs">    <h3 class="heading heading-sm fg-text-inverse">Your trial ends in three days</h3>    <p class="m(0) text-sm">Add a card to keep your projects online.</p>  </div>  <button type="button" class="btn btn-sm">Add a card</button></section>
<section className="sheet sheet-inverse flex flex-wrap items-center justify-between gap-md p-lg">  <div className="flex flex-col gap-3xs">    <h3 className="heading heading-sm fg-text-inverse">Your trial ends in three days</h3>    <p className="m(0) text-sm">Add a card to keep your projects online.</p>  </div>  <button type="button" className="btn btn-sm">Add a card</button></section>
<section class="sheet sheet-inverse flex flex-wrap items-center justify-between gap-md p-lg">  <div class="flex flex-col gap-3xs">    <h3 class="heading heading-sm fg-text-inverse">Your trial ends in three days</h3>    <p class="m(0) text-sm">Add a card to keep your projects online.</p>  </div>  <button type="button" class="btn btn-sm">Add a card</button></section>
<template>  <section class="sheet sheet-inverse flex flex-wrap items-center justify-between gap-md p-lg">    <div class="flex flex-col gap-3xs">      <h3 class="heading heading-sm fg-text-inverse">Your trial ends in three days</h3>      <p class="m(0) text-sm">Add a card to keep your projects online.</p>    </div>    <button type="button" class="btn btn-sm">Add a card</button>  </section></template>

#ウェル

ウェルは周囲よりくぼんだ面です。柔らかな内側の影と 0.5px の輪郭が付き、下端のすぐ下にハイライトが入ります。入力欄、セグメントコントロールのトラック、スイッチにはウェルを使います。

--well-radius は、テーマの角丸スケールを適用する前のウェルの角の半径を変更します。既定値は var(--radius-control) です。

ウェル

<div class="well p-lg text-sm fg-text-muted">Drop files here</div>
<div className="well p-lg text-sm fg-text-muted">Drop files here</div>
<div class="well p-lg text-sm fg-text-muted">Drop files here</div>
<template>  <div class="well p-lg text-sm fg-text-muted">Drop files here</div></template>

#トレイ

トレイは、1 枚以上のシートを収めるくぼんだ面です。内側に 4px の余白を設け、トレイの角の半径を、スケール適用後のシートの半径にその余白を加えた値にすることで、角の丸みが揃います。既定の角丸スケールは 1.6 なので、サーフェスの半径は 16px から 25.6px になり、トレイの半径は 29.6px になります。

トレイ

<div class="tray">  <p class="m(0) px-md py-sm text-xs fg-text-muted">Recent</p>  <div class="sheet p-lg text-sm fg-text-body">Quarterly report.pdf</div></div>
<div className="tray">  <p className="m(0) px-md py-sm text-xs fg-text-muted">Recent</p>  <div className="sheet p-lg text-sm fg-text-body">Quarterly report.pdf</div></div>
<div class="tray">  <p class="m(0) px-md py-sm text-xs fg-text-muted">Recent</p>  <div class="sheet p-lg text-sm fg-text-body">Quarterly report.pdf</div></div>
<template>  <div class="tray">    <p class="m(0) px-md py-sm text-xs fg-text-muted">Recent</p>    <div class="sheet p-lg text-sm fg-text-body">Quarterly report.pdf</div>  </div></template>

シート以外のコンポーネントをトレイに直接収める場合も、シートと同じ角の半径が必要です。収めるコンポーネントのルート要素で、ウェルなら --well-radius、コードブロックやパネルなら --code-radius、ウィンドウなら --window-radius、アラートなら --alert-radius に var(--radius-surface) を指定します。トレイは角丸スケールの適用後に 4px の余白を加えるため、既定のテーマでも Paper でも角の丸みが揃います。さらに内側のコンポーネントには、それぞれ固有の半径が適用されます。

トレイに収めたウェル

<div class="tray">  <div class="well p-lg text-sm" style="--well-radius: var(--radius-surface)">    No builds are queued.  </div></div>
<div className="tray">  <div className="well p-lg text-sm" style={{ '--well-radius': 'var(--radius-surface)' } as React.CSSProperties}>    No builds are queued.  </div></div>
<div class="tray">  <div class="well p-lg text-sm" style="--well-radius: var(--radius-surface)">    No builds are queued.  </div></div>
<template>  <div class="tray">    <div class="well p-lg text-sm" style="--well-radius: var(--radius-surface)">      No builds are queued.    </div>  </div></template>

#サーフェスの色

各サーフェスは、自身の色を --surface-color として公開します。コーナーバッジ、重ねたアバター、ステータスドットの周囲のリングなど、背景をくり抜いたように見せる部分は、この色を参照します。そのため、シート、トレイ、ウェル、カード、ダイアログの中では、リングの色が背景に自動で揃います。独自のサーフェスを使う場合は、このプロパティにその背景色を設定します。

#ユーティリティで組み立てる

これらの素材はテーマトークンにもなっているため、bg-surface-raised、shadow-raised、shadow-pressed、b-line-contour のユーティリティで独自の要素に適用できます。

素材を適用するユーティリティ

<div class="p-lg r-lg bg-surface-raised shadow-raised text-sm fg-text-body">  bg-surface-raised shadow-raised</div>
<div className="p-lg r-lg bg-surface-raised shadow-raised text-sm fg-text-body">  bg-surface-raised shadow-raised</div>
<div class="p-lg r-lg bg-surface-raised shadow-raised text-sm fg-text-body">  bg-surface-raised shadow-raised</div>
<template>  <div class="p-lg r-lg bg-surface-raised shadow-raised text-sm fg-text-body">    bg-surface-raised shadow-raised  </div></template>

#クラス

クラス説明
sheet16px の角丸、幅 0.5px の輪郭、浮き上がりを示す影を持つ隆起した面
sheet-flat輪郭1本、影なし。密度の高いリストや表向けsheet と併用します
sheet-raised要素の多い面に置く小さなカード向けの、既定より1段階低い浮き上がりの影。sheet と併用します
sheet-floatingコンテンツの上に重なるポップオーバーやメニュー用の、浮いたサーフェスと影。sheet と併用します
sheet-inverse前景色を背景に使い、テキストには反転色を使うシートです。ページ内でユーザーに行動を促す 1 か所に使います。sheet と併用します
well10px の角丸と内側の影を持つ、くぼんだ面
tray1 枚以上のシートを収めるくぼんだホルダー。内側に 4px の余白を取り、シートの 16px の角丸を 20px の角丸で囲む

#カスタムプロパティ

プロパティ既定値説明
--well-radiusvar(--radius-control)角のスケールを適用する前の円弧の半径です。トレイに直接収めるくぼみには var(--radius-surface) を使います。指定先:well
--surface-colorvar(--color-surface-raised)背後のサーフェスを形に沿って切り抜くリングが参照するシートの色。浮いたシートと反転したシートはそれぞれ独自の色を設定します。指定先:sheet
--surface-colorvar(--color-surface-inset)背後のサーフェスを形に沿って切り抜くリングが参照するくぼみの色指定先:well
--surface-colorvar(--color-surface-tray)背後のサーフェスを形に沿って切り抜くリングが参照するトレイの色指定先:tray

#ソース

@master/ui/components/surface.css
/* * Surfaces: the material ladder in markup. * tray (a recessed holder) → sheet (a raised face) → floating; a well sits below its surroundings. * A sheet can also be ink, for the one surface on a page that asks for something. * Radii nest by a 4px inset: tray 20 → sheet 16, and a control inside is 10. * Each surface publishes its color as --surface-color, so a ring that cuts a shape out of it * (a corner badge, a stack of avatars) matches whatever it sits on. */@layer components.ui {  .sheet {    --surface-color: var(--color-surface-raised);    position: relative;    min-width: 0;    border-radius: calc(var(--radius-surface) * var(--corner-scale));    corner-shape: var(--corner-shape);    @apply --surface-sheet;    color: var(--color-text-body);    box-shadow: var(--shadow-lifted);    &.sheet-raised {      box-shadow: var(--shadow-raised);    }    &.sheet-floating {      --surface-color: var(--color-surface-floating);      background: var(--color-surface-floating);      box-shadow: var(--shadow-floating);    }    &.sheet-flat {      background: var(--color-surface-raised);      box-shadow: var(--shadow-flat);    }    /*     * Inverse: a sheet of ink, pearl on obsidian. It is the face of a primary button at the size of a surface:     * the same fall of light, the same line of light on its top edge. Use one on a page, for the moment     * that asks for something. Words on it take the inverse ink; a default button on it reads as the action.     */    &.sheet-inverse {      @apply --on-ink;      --surface-color: var(--color-surface-inverse);      @apply --surface-ink;      color: var(--color-text-inverse);      box-shadow:        inset 0 .5px 0 var(--color-ink-highlight),        0 0 0 .5px var(--color-ink-edge),        0 1px 2px -1px var(--color-shade-1), 0 2px 4px -2px var(--color-shade-2), 0 4px 8px -4px var(--color-shade-3), 0 8px 16px -8px var(--color-shade-4);    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }  .well {    --well-radius: var(--radius-control);    --surface-color: var(--color-surface-inset);    min-width: 0;    border-radius: calc(var(--well-radius) * var(--corner-scale));    corner-shape: var(--corner-shape);    background: var(--color-surface-inset);    box-shadow: var(--shadow-pressed);    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }  /* A tray's corner is the sheet's corner plus its 4px inset, so the gap keeps one width around the bend. */  .tray {    --surface-color: var(--color-surface-tray);    position: relative;    min-width: 0;    padding: 4px;    border-radius: calc(var(--radius-surface) * var(--corner-scale) + 4px);    corner-shape: var(--corner-shape);    background: var(--color-surface-tray);    color: var(--color-text-body);    /* Recessed by tone and a hairline; it holds raised sheets, so it casts no shadow of its own. */    box-shadow: inset 0 0 0 .5px var(--color-line-hair), inset 0 1px 2px -1px var(--color-shade-2);    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }}