탐색

v2.1.0
작업

링크

문장 속에서 주변 텍스트와 같은 색으로 표시되며 다른 위치로 이동하는 텍스트입니다.

이 페이지의 내용

링크는 문장 속에서 주변 텍스트와 같은 색으로 표시되며 다른 위치로 이동하는 텍스트입니다. 인터페이스는 단색이므로 링크를 색상 대신 밑줄로 구분합니다. 평소에는 밑줄이 은은하게 보이고, 포인터를 올리면 텍스트와 같은 색으로 선명해집니다. <a> 요소에 .link를 적용하세요.

링크

<p class="m(0) text-sm fg-text-body leading-md">  Master UI reads Master CSS tokens. Start with the <a class="link" href="#installation">installation guide</a>, then read how the <a class="link" href="#theme">theme</a> is built.</p>
<p className="m(0) text-sm fg-text-body leading-md">  Master UI reads Master CSS tokens. Start with the <a className="link" href="#installation">installation guide</a>, then read how the <a className="link" href="#theme">theme</a> is built.</p>
<p class="m(0) text-sm fg-text-body leading-md">  Master UI reads Master CSS tokens. Start with the <a class="link" href="#installation">installation guide</a>, then read how the <a class="link" href="#theme">theme</a> is built.</p>
<template>  <p class="m(0) text-sm fg-text-body leading-md">    Master UI reads Master CSS tokens. Start with the <a class="link" href="#installation">installation guide</a>, then read how the <a class="link" href="#theme">theme</a> is built.  </p></template>

#은은한 링크

link-quiet는 주변 텍스트와 같은 색을 사용하며 포인터를 올리기 전까지 밑줄을 표시하지 않습니다. 푸터, 메타데이터, 탐색 목록처럼 링크가 모여 있어 밑줄이 지나치게 도드라지는 곳에 사용하세요. 위치나 문구만으로도 링크임을 알아볼 수 있어야 합니다.

은은한 링크

<nav class="flex gap-md text-sm fg-text-muted" aria-label="Footer">  <a class="link link-quiet" href="#docs">Docs</a>  <a class="link link-quiet" href="#changelog">Changelog</a>  <a class="link link-quiet" href="#license">License</a></nav>
<nav className="flex gap-md text-sm fg-text-muted" aria-label="Footer">  <a className="link link-quiet" href="#docs">Docs</a>  <a className="link link-quiet" href="#changelog">Changelog</a>  <a className="link link-quiet" href="#license">License</a></nav>
<nav class="flex gap-md text-sm fg-text-muted" aria-label="Footer">  <a class="link link-quiet" href="#docs">Docs</a>  <a class="link link-quiet" href="#changelog">Changelog</a>  <a class="link link-quiet" href="#license">License</a></nav>
<template>  <nav class="flex gap-md text-sm fg-text-muted" aria-label="Footer">    <a class="link link-quiet" href="#docs">Docs</a>    <a class="link link-quiet" href="#changelog">Changelog</a>    <a class="link link-quiet" href="#license">License</a>  </nav></template>

#새 탭 링크

target="_blank"이 적용된 링크에는 텍스트 줄 바깥을 가리키는 작은 화살표가 표시되어 현재 페이지를 벗어난다는 점을 미리 알 수 있습니다. 화살표는 장식입니다. 화살표를 볼 수 없는 사용자도 알 수 있도록 링크의 접근 가능한 이름이나 표시 텍스트에 "새 탭에서 열림"을 포함하세요.

새 탭

<p class="m(0) text-sm fg-text-body leading-md">  The corner shape follows the <a class="link" href="#spec" target="_blank" rel="noopener">    CSS Borders specification<span class="sr-only">(opens in a new tab)</span>  </a>.</p>
<p className="m(0) text-sm fg-text-body leading-md">  The corner shape follows the <a className="link" href="#spec" target="_blank" rel="noopener">    CSS Borders specification<span className="sr-only">(opens in a new tab)</span>  </a>.</p>
<p class="m(0) text-sm fg-text-body leading-md">  The corner shape follows the <a class="link" href="#spec" target="_blank" rel="noopener">    CSS Borders specification<span class="sr-only">(opens in a new tab)</span>  </a>.</p>
<template>  <p class="m(0) text-sm fg-text-body leading-md">    The corner shape follows the <a class="link" href="#spec" target="_blank" rel="noopener">      CSS Borders specification<span class="sr-only">(opens in a new tab)</span>    </a>.  </p></template>

링크는 다른 위치로 이동할 때 사용하고 버튼은 동작을 실행할 때 사용합니다. 컨트롤처럼 보이는 탐색 링크가 필요하면 <a> 요소에 btn을 적용하세요. 문장 안에서 "실행 취소" 같은 동작을 제공하려면 <button type="button"> 요소에 link를 적용해 버튼의 키보드 동작과 시맨틱을 유지하세요.

문장 안의 버튼

<p class="m(0) text-sm fg-text-body">  The project was archived. <button type="button" class="link">Undo</button></p>
<p className="m(0) text-sm fg-text-body">  The project was archived. <button type="button" className="link">Undo</button></p>
<p class="m(0) text-sm fg-text-body">  The project was archived. <button type="button" class="link">Undo</button></p>
<template>  <p class="m(0) text-sm fg-text-body">    The project was archived. <button type="button" class="link">Undo</button>  </p></template>

#클래스

클래스설명
link진한 글자색의 밑줄 링크. 포인터를 올리면 밑줄도 글자와 같은 진한 색으로 바뀝니다.
link-quiet색상을 상속하고 상호작용할 때만 밑줄을 표시합니다. 푸터, 메타데이터, 탐색 목록에 사용합니다적용할 클래스는 link입니다

#소스

@master/ui/components/link.css
/* * Link: text that goes somewhere, in the ink of its sentence. * The underline is a quiet line at rest and takes the full ink under the pointer, so links read without a hue. */@layer components.ui {  .link {    /* A button written as a link, for an action inside a sentence, drops the button's box. */    margin: 0;    padding: 0;    border: 0;    /* A small corner for the focus ring, from the chip's role and drawn as every other corner is. */    border-radius: calc((var(--radius-chip) - 4px) * var(--corner-scale));    corner-shape: var(--corner-shape);    background: none;    font: inherit;    font-feature-settings: inherit;    appearance: none;    color: var(--color-text-strong);    text-decoration: underline;    text-decoration-color: var(--color-line-mark);    text-decoration-thickness: max(1px, .0625em);    text-underline-offset: .2em;    cursor: pointer;    -webkit-tap-highlight-color: transparent;    transition: text-decoration-color var(--duration-quick) var(--easing-glide), color var(--duration-quick) var(--easing-glide);    @media (hover: hover) {      &:hover {        text-decoration-color: currentColor;      }    }    /* Pressed: the full line, as under the pointer, so a tap is answered too. */    &:active {      text-decoration-color: currentColor;    }    &:focus-visible {      @apply --focus-ring;    }    /* A link that opens a new tab points out of the line it is in. Say "opens in a new tab" in its name too. */    &[target="_blank"]::after {      content: '';      display: inline-block;      width: .6875em;      height: .6875em;      margin-inline-start: .1875em;      background: currentColor;      opacity: .6;      mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.5 7.5 2.5M3.5 2.5h4v4'/%3E%3C/svg%3E") center / contain no-repeat;    }    /* From right to left the line runs the other way, and so does the arrow out of it. */    &[target="_blank"]:dir(rtl)::after {      scale: -1 1;    }    /* No line until touched, where a row of links would otherwise rule the page: footers, metadata, navigation. */    &.link-quiet {      color: inherit;      text-decoration-color: transparent;      @media (hover: hover) {        &:hover:not(:disabled, [aria-disabled="true"]) {          color: var(--color-text-strong);          text-decoration-color: var(--color-line-mark);        }      }      /* Pressed: the line shows here too, so a tap on a touch screen is answered. */      &:active:not(:disabled, [aria-disabled="true"]) {        color: var(--color-text-strong);        text-decoration-color: currentColor;      }    }    @media (forced-colors: active) {      color: LinkText;      text-decoration-color: currentColor;      /*       * The arrow is a fill under a mask, and forced colors would turn its fill to the canvas behind it: it keeps the       * link's own system color, at full strength.       */      &[target="_blank"]::after {        forced-color-adjust: none;        opacity: 1;      }    }  }  /* A link that cannot be followed now: no destination is promised, so it loses its ink and its line. */  .link:is(:disabled, [aria-disabled="true"]) {    color: var(--color-text-disabled);    text-decoration-color: transparent;    cursor: not-allowed;    @media (forced-colors: active) {      color: GrayText;    }  }}