탐색

v2.1.0
재질

구분선

섹션 사이에 놓이는 가느다란 선으로, 필요에 따라 레이블을 넣을 수 있습니다.

이 페이지의 내용

구분선은 섹션 사이에 놓이는 가느다란 선입니다. 기본적으로 구분자 역할을 하는 <hr>에 .divider 클래스를 적용하세요. 선은 두 요소를 가장 뚜렷하게 나누는 수단이므로, 간격과 그룹화만으로 구분이 어려울 때 사용하세요.

구분선

<p class="m(0) text-sm fg-text-body">Billing is managed by the workspace owner.</p><hr class="divider"><p class="m(0) text-sm fg-text-body">Invoices are sent on the first day of each month.</p>
<>  <p className="m(0) text-sm fg-text-body">Billing is managed by the workspace owner.</p>  <hr className="divider" />  <p className="m(0) text-sm fg-text-body">Invoices are sent on the first day of each month.</p></>
<p class="m(0) text-sm fg-text-body">Billing is managed by the workspace owner.</p><hr class="divider"><p class="m(0) text-sm fg-text-body">Invoices are sent on the first day of each month.</p>
<template>  <p class="m(0) text-sm fg-text-body">Billing is managed by the workspace owner.</p>  <hr class="divider">  <p class="m(0) text-sm fg-text-body">Invoices are sent on the first day of each month.</p></template>

#레이블이 있는 구분선

divider-label은 레이블 양옆으로 선을 나눕니다. <hr>에는 텍스트를 넣을 수 없으므로 role="separator"가 지정된 요소에 적용하세요.

레이블이 있는 구분선

<button type="button" class="btn w-full">Continue with a passkey</button><div class="divider divider-label" role="separator">or</div><input class="input" type="email" placeholder="you@example.com" aria-label="Email">
<>  <button type="button" className="btn w-full">Continue with a passkey</button>  <div className="divider divider-label" role="separator">or</div>  <input className="input" type="email" placeholder="you@example.com" aria-label="Email" /></>
<button type="button" class="btn w-full">Continue with a passkey</button><div class="divider divider-label" role="separator">or</div><input class="input" type="email" placeholder="you@example.com" aria-label="Email">
<template>  <button type="button" class="btn w-full">Continue with a passkey</button>  <div class="divider divider-label" role="separator">or</div>  <input class="input" type="email" placeholder="you@example.com" aria-label="Email"></template>

#세로 구분선

divider-vertical은 한 행의 항목 사이에 놓이며 행 높이만큼 세로로 뻗습니다. 컨트롤 그룹을 구분할 때는 role="separator"와 aria-orientation="vertical"을 지정하세요. 시각적 용도로만 쓰는 경우에는 aria-hidden="true"를 지정해 보조 기술에서 숨기세요.

세로 구분선

<div class="flex items-center gap-sm">  <button type="button" class="btn btn-quiet btn-sm">Edit</button>  <span class="divider divider-vertical" role="separator" aria-orientation="vertical"></span>  <button type="button" class="btn btn-quiet btn-sm">Share</button>  <button type="button" class="btn btn-quiet btn-sm">Export</button></div>
<div className="flex items-center gap-sm">  <button type="button" className="btn btn-quiet btn-sm">Edit</button>  <span className="divider divider-vertical" role="separator" aria-orientation="vertical"></span>  <button type="button" className="btn btn-quiet btn-sm">Share</button>  <button type="button" className="btn btn-quiet btn-sm">Export</button></div>
<div class="flex items-center gap-sm">  <button type="button" class="btn btn-quiet btn-sm">Edit</button>  <span class="divider divider-vertical" role="separator" aria-orientation="vertical"></span>  <button type="button" class="btn btn-quiet btn-sm">Share</button>  <button type="button" class="btn btn-quiet btn-sm">Export</button></div>
<template>  <div class="flex items-center gap-sm">    <button type="button" class="btn btn-quiet btn-sm">Edit</button>    <span class="divider divider-vertical" role="separator" aria-orientation="vertical"></span>    <button type="button" class="btn btn-quiet btn-sm">Share</button>    <button type="button" class="btn btn-quiet btn-sm">Export</button>  </div></template>

#클래스

클래스설명
divider--color-line-divider 색상의 1px 구분선
divider-vertical행 안의 항목을 나누는 구분선입니다. 높이는 행과 같습니다적용할 클래스는 divider입니다
divider-label구분선은 "또는" 같은 문구를 사이에 두고 양쪽으로 나뉩니다. hr에는 텍스트를 넣을 수 없으므로 role="separator"가 지정된 요소에 이 구분선을 적용합니다.적용할 클래스는 divider입니다

#소스

@master/ui/components/divider.css
/* * Divider: one hairline between sections, on an <hr> or an element with role="separator". * With a label, the line parts around the words. */@layer components.ui {  .divider {    flex: none;    height: 1px;    margin: 0;    border: 0;    background: var(--color-line-divider);    color: var(--color-text-muted);    /* Between items in a row: it takes the row's height. */    &.divider-vertical {      align-self: stretch;      width: 1px;      height: auto;      min-height: 1em;    }    /* A caption in the line, such as "or". */    &.divider-label {      display: flex;      align-items: center;      gap: .75rem;      height: auto;      background: none;      font-size: .75rem;      line-height: 1.5;      /* A caption longer than its room wraps in the middle and leaves a line on each side, so it still parts. */      text-align: center;      text-wrap: balance;      &::before, &::after {        content: '';        flex: 1 0 1.5rem;        height: 1px;        background: var(--color-line-divider);      }    }    @media (forced-colors: active) {      background: CanvasText;      &.divider-label {        background: none;        &::before, &::after {          background: CanvasText;        }      }    }  }}