サーフェス
トレイ、シート、ウェル。すべてのコンポーネントの土台となる、奥行きの異なる素材です。
このページの内容
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>#クラス
| クラス | 説明 |
|---|---|
sheet | 16px の角丸、幅 0.5px の輪郭、浮き上がりを示す影を持つ隆起した面 |
sheet-flat | 輪郭1本、影なし。密度の高いリストや表向けsheet と併用します |
sheet-raised | 要素の多い面に置く小さなカード向けの、既定より1段階低い浮き上がりの影。sheet と併用します |
sheet-floating | コンテンツの上に重なるポップオーバーやメニュー用の、浮いたサーフェスと影。sheet と併用します |
sheet-inverse | 前景色を背景に使い、テキストには反転色を使うシートです。ページ内でユーザーに行動を促す 1 か所に使います。sheet と併用します |
well | 10px の角丸と内側の影を持つ、くぼんだ面 |
tray | 1 枚以上のシートを収めるくぼんだホルダー。内側に 4px の余白を取り、シートの 16px の角丸を 20px の角丸で囲む |
#カスタムプロパティ
| プロパティ | 既定値 | 説明 |
|---|---|---|
--well-radius | var(--radius-control) | 角のスケールを適用する前の円弧の半径です。トレイに直接収めるくぼみには var(--radius-surface) を使います。指定先:well |
--surface-color | var(--color-surface-raised) | 背後のサーフェスを形に沿って切り抜くリングが参照するシートの色。浮いたシートと反転したシートはそれぞれ独自の色を設定します。指定先:sheet |
--surface-color | var(--color-surface-inset) | 背後のサーフェスを形に沿って切り抜くリングが参照するくぼみの色指定先:well |
--surface-color | var(--color-surface-tray) | 背後のサーフェスを形に沿って切り抜くリングが参照するトレイの色指定先:tray |