탐색

v2.1.0
타이포그래피

멘션

문장 안에서 사람이나 팀, 대상을 가리키는 표시입니다.

이 페이지의 내용

멘션은 문장 안에서 @Ada, #design, 이슈 번호처럼 사람이나 팀, 대상을 가리킵니다. 문장의 서체와 글자색을 그대로 쓰되, 글자 굵기는 컨트롤과 맞추고 배경에는 글자색을 옅게 적용합니다. 윤곽선이 없어 인라인 코드와 구분됩니다.

멘션

<div class="flex flex-col max-w(440) mx-auto">  <div class="message">    <div class="message-bubble">      <a class="mention" href="#">@Ada Lovelace</a> the build for <a class="mention" href="#">#412</a> is green. Can <a class="mention mention-self" href="#">@you</a> review it before <span class="mention">Friday</span>?    </div>  </div>  <div class="message message-sent">    <div class="message-bubble">      On it. I will loop in <a class="mention" href="#">@design</a> for the corners.    </div>  </div></div>
<div className="flex flex-col max-w(440) mx-auto">  <div className="message">    <div className="message-bubble">      <a className="mention" href="#">@Ada Lovelace</a> the build for <a className="mention" href="#">#412</a> is green. Can <a className="mention mention-self" href="#">@you</a> review it before <span className="mention">Friday</span>?    </div>  </div>  <div className="message message-sent">    <div className="message-bubble">      On it. I will loop in <a className="mention" href="#">@design</a> for the corners.    </div>  </div></div>
<div class="flex flex-col max-w(440) mx-auto">  <div class="message">    <div class="message-bubble">      <a class="mention" href="#">@Ada Lovelace</a> the build for <a class="mention" href="#">#412</a> is green. Can <a class="mention mention-self" href="#">@you</a> review it before <span class="mention">Friday</span>?    </div>  </div>  <div class="message message-sent">    <div class="message-bubble">      On it. I will loop in <a class="mention" href="#">@design</a> for the corners.    </div>  </div></div>
<template>  <div class="flex flex-col max-w(440) mx-auto">    <div class="message">      <div class="message-bubble">        <a class="mention" href="#">@Ada Lovelace</a> the build for <a class="mention" href="#">#412</a> is green. Can <a class="mention mention-self" href="#">@you</a> review it before <span class="mention">Friday</span>?      </div>    </div>    <div class="message message-sent">      <div class="message-bubble">        On it. I will loop in <a class="mention" href="#">@design</a> for the corners.      </div>    </div>  </div></template>

<a> 요소의 멘션은 프로필이나 이슈로 연결되며, 포인터를 올리면 배경색이 더 짙어집니다. <span> 요소의 멘션은 파서가 인식한 날짜처럼 특정 텍스트를 구분해 표시하기만 합니다. 스타일시트는 :any-link를 기준으로 둘을 구분해, 이동할 수 없는 멘션이 링크처럼 보이지 않게 합니다.

#읽는 사람의 이름

mention-self는 읽는 사람을 가리키는 멘션을 조금 더 짙은 배경색과 아주 가는 윤곽선으로 표시해, 긴 스레드에서도 자기 이름을 한눈에 찾을 수 있게 합니다. 글자색은 다른 멘션과 같습니다. 색조 차이를 의도적으로 작게 두므로, 본문에서는 "당신"처럼 읽는 사람을 직접 부르거나 그 사람의 이름을 적으세요.

#본문 속 멘션

멘션 중간에서는 줄이 바뀌지 않습니다. 현재 글자색을 섞어 배경색과 아주 가는 윤곽선의 색을 만들기 때문에, 문장이 읽히는 곳이라면 멘션도 읽을 수 있습니다. 예를 들어 보낸 메시지의 말풍선에는 잉크 색을 채우며, 멘션은 말풍선의 밝은 글자색을 그대로 쓰고 배경에도 그 색을 옅게 깝니다.

#접근성

  • 기호도 텍스트의 일부입니다. 복사하거나 스크린 리더가 읽을 때도 멘션이 동일하게 전달되도록 요소 안에 @ 또는 # 기호를 직접 적으세요.
  • 프로필을 여는 멘션은 링크이므로 별도의 역할을 지정할 필요가 없습니다.

#클래스

클래스설명
mention이름은 문장과 같은 글꼴과 글자색으로 표시하며, 글자 굵기는 컨트롤과 같고 배경은 글자색을 옅게 적용합니다. 이름은 줄 중간에서 나뉘지 않으며, 링크인 경우 포인터를 올리면 배경색이 짙어집니다.
mention-self사용자 본인의 이름에는 더 진한 색조와 가는 테두리를 적용합니다.적용할 클래스는 mention입니다

#소스

@master/ui/components/mention.css
/* * Mention: a person, a team or a thing named inside a sentence: @Ada, #design, an issue's number. * It is the sentence's own type and its own ink at the control weight, on a faint tint of that ink, with no * contour, which tells it apart from inline code. Because the tint and the hairline are mixed from the * current color, a mention reads on any surface: a page, a card, the ink of a sent message. * As a link it deepens under the pointer. mention-self marks the reader's own name with a firmer tint and a * hairline, so it is found at a glance in a long thread. */@layer components.ui {  .mention {    --mention-tint: 7%;    padding: .0625em .3125em;    border-radius: calc((var(--radius-chip) - 2px) * var(--corner-scale));    corner-shape: var(--corner-shape);    background: color-mix(in oklab, currentColor var(--mention-tint), transparent);    color: inherit;    font-weight: var(--font-weight-control);    text-decoration: none;    white-space: nowrap;    -webkit-box-decoration-break: clone;    box-decoration-break: clone;    @media (hover: hover) {      &:any-link:hover {        --mention-tint: 13%;      }    }    /* Pressed: the same deeper tint, so a tap on a touch screen is answered too. */    &:any-link:active {      --mention-tint: 13%;    }    &:focus-visible {      outline: 2px solid var(--color-focus);      outline-offset: 2px;    }    &.mention-self {      --mention-tint: 12%;      box-shadow: inset 0 0 0 .5px color-mix(in oklab, currentColor 28%, transparent);      /* Its own tint is already firmer, so as a link it deepens from there. */      @media (hover: hover) {        &:any-link:hover {          --mention-tint: 18%;        }      }      &:any-link:active {        --mention-tint: 18%;      }    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }}