탐색

v2.1.0
재질

겹침

맨 위 항목 아래로 나머지 항목의 가장자리를 드러내 여러 항목을 하나로 보여 주는 컴포넌트.

이 페이지의 내용

겹침은 같은 종류의 알림, 함께 전송된 파일, 한 문서의 초안처럼 여러 항목을 하나로 보여 줍니다. 맨 위에 표면 하나를 담고, 그 아래에 너비가 한 단계씩 좁아지고 위치가 한 단계씩 낮아지며 한 단계씩 더 희미하게 보이는 표면 두 장을 그립니다. 아래 두 장은 그림자가 아니라 맨 위 표면 아래에 포개진 시트처럼 보입니다.

겹침

<div class="pile w-full max-w(340)">  <article class="card">    <header class="card-header">      <h3 class="card-title">3 deployments failed</h3>      <p class="card-description">atlas.dev, in the last hour</p>      <button class="card-action btn btn-sm" type="button">Show all</button>    </header>  </article></div>
<div className="pile w-full max-w(340)">  <article className="card">    <header className="card-header">      <h3 className="card-title">3 deployments failed</h3>      <p className="card-description">atlas.dev, in the last hour</p>      <button className="card-action btn btn-sm" type="button">Show all</button>    </header>  </article></div>
<div class="pile w-full max-w(340)">  <article class="card">    <header class="card-header">      <h3 class="card-title">3 deployments failed</h3>      <p class="card-description">atlas.dev, in the last hour</p>      <button class="card-action btn btn-sm" type="button">Show all</button>    </header>  </article></div>
<template>  <div class="pile w-full max-w(340)">    <article class="card">      <header class="card-header">        <h3 class="card-title">3 deployments failed</h3>        <p class="card-description">atlas.dev, in the last hour</p>        <button class="card-action btn btn-sm" type="button">Show all</button>      </header>    </article>  </div></template>

#겹쳐 그리는 표면

겹침은 카드, 시트, 파일 같은 표면 하나를 담는 컨테이너입니다. 스타일시트는 아래쪽 두 장을 각각 바로 위 표면보다 양옆으로 8px씩 안쪽에, 세로로는 6px 아래에 그립니다. 겹침 컴포넌트가 맨 위 표면 아래에 12px의 공간을 확보하므로 뒤따르는 요소에 여백을 따로 줄 필요가 없습니다.

아래쪽 두 장은 --pile-radius에 지정된 표면의 모서리 반경을 따릅니다. 맨 위 표면의 모서리 반경이 다르면 아래 파일 예시처럼 해당 속성에 그 값을 지정하세요. --pile-step과 --pile-inset으로 각 장이 얼마나 드러나는지 조절할 수 있습니다.

파일

<div class="pile w-full max-w(280)" style="--pile-radius: var(--radius-control-lg)">  <div class="file">    <span class="file-page">pdf</span>    <div class="file-body">      <p class="file-name">Quarterly report.pdf</p>      <p class="file-meta">and 4 more files · 12.8 MB</p>    </div>  </div></div>
<div className="pile w-full max-w(280)" style={{ '--pile-radius': 'var(--radius-control-lg)' } as React.CSSProperties}>  <div className="file">    <span className="file-page">pdf</span>    <div className="file-body">      <p className="file-name">Quarterly report.pdf</p>      <p className="file-meta">and 4 more files · 12.8 MB</p>    </div>  </div></div>
<div class="pile w-full max-w(280)" style="--pile-radius: var(--radius-control-lg)">  <div class="file">    <span class="file-page">pdf</span>    <div class="file-body">      <p class="file-name">Quarterly report.pdf</p>      <p class="file-meta">and 4 more files · 12.8 MB</p>    </div>  </div></div>
<template>  <div class="pile w-full max-w(280)" style="--pile-radius: var(--radius-control-lg)">    <div class="file">      <span class="file-page">pdf</span>      <div class="file-body">        <p class="file-name">Quarterly report.pdf</p>        <p class="file-meta">and 4 more files · 12.8 MB</p>      </div>    </div>  </div></template>

#항목 수 표시

맨 위 표면 아래에 있는 두 장은 장식입니다. 항목이 3개든 30개든 항상 두 장이며 스크린 리더가 읽지 않습니다. 맨 위 표면에 항목 수를 텍스트로 표시하고, 그룹을 여는 버튼이나 목록으로 이동하는 링크를 제공해 모든 항목을 볼 수 있게 하세요.

#겹침, 목록, 아바타 그룹

겹침은 모든 항목을 보여 줄 필요가 없을 때 사용합니다. 각 항목을 모두 보여 주는 것이 중요하다면 목록을 사용하세요. 여러 사람을 나타낼 때는 얼굴을 겹쳐 보여 주는 아바타 그룹을 사용하세요. 슬라이드를 차례로 넘겨 볼 때는 캐러셀을 사용하세요.

#접근성

  • 겹침은 자체 역할이나 이름을 추가하지 않습니다. 의미는 겹침에 담긴 표면이 전달합니다.
  • 겹친 모양만으로는 항목 수를 알 수 없으므로 텍스트로 표시하세요.
  • 강제 색상 모드에서는 아래쪽 두 장에 시스템 색상의 윤곽선이 적용되며 두 장 모두 완전히 불투명해집니다.

#클래스

클래스설명
pile맨 위 표면을 담는 요소입니다. 뒤에 표면 두 장을 겹치며, 각 장은 바로 위 장보다 양쪽에서 각각 8px 안으로 들어가고 6px 아래에 놓입니다.

#사용자 지정 속성

속성기본값설명
--pile-radiusvar(--radius-surface)맨 위 표면 아래에 겹친 두 장의 모서리 반경입니다. 맨 위 표면의 모서리 반경과 같은 값으로 지정하세요.
--pile-step.375rem각 시트가 위 시트 아래로 드러나는 높이입니다
--pile-inset.5rem각 시트의 양쪽 가장자리가 위 시트보다 안으로 들어가는 거리입니다

#소스

@master/ui/components/pile.css
/* * Pile: several things shown as one, with the edges of the others under it. * The pile holds one surface, the top one, and draws two more behind it: each a step narrower, a step lower * and a step fainter, so they read as sheets lying under the first and not as a shadow. Nothing in them is * content: say how many there are in words, on the top one. * Geometry: each sheet under the top is 8px in on both sides and shows 6px below the one above it. They take * the corner in --pile-radius, a surface's corner unless the top sheet has another. */@layer components.ui {  .pile {    --pile-radius: var(--radius-surface);    --pile-step: .375rem;    --pile-inset: .5rem;    position: relative;    /* The sheets lie behind the top one, and no further back than the pile. */    isolation: isolate;    display: grid;    min-width: 0;    margin: 0;    padding-block-end: calc(var(--pile-step) * 2);    &::before, &::after {      content: '';      position: absolute;      inset-block-start: 1rem;      border-radius: calc(var(--pile-radius) * var(--corner-scale));      corner-shape: var(--corner-shape);      background: var(--color-surface-raised-low);      box-shadow: var(--shadow-flat), 0 1px 2px -1px var(--color-shade-2);      pointer-events: none;    }    /* The second sheet. */    &::before {      z-index: -1;      inset-block-end: var(--pile-step);      inset-inline: var(--pile-inset);      opacity: .8;    }    /* The third. */    &::after {      z-index: -2;      inset-block-end: 0;      inset-inline: calc(var(--pile-inset) * 2);      opacity: .5;    }    @media (forced-colors: active) {      &::before, &::after {        outline: 1px solid CanvasText;        outline-offset: -1px;        opacity: 1;      }    }  }}