@atlaskit/lozenge
로젠지(Lozenge)는 사람들이 객체를 어떻게 이해하고 우선순위를 두거나 행동하는지에 영향을 주는 의미 있는 속성을 전달하는, 눈에 띄는 컴팩트한 라벨이에요.
출처: 문서
본문
Lozenge 컴포넌트
로젠지는 사람들이 객체를 어떻게 이해하고 우선순위를 두거나 행동하는지에 영향을 주는 의미 있는 속성을 전달하는, 눈에 띄는 컴팩트한 라벨이에요.
- Keywords: lozenge, badge, label, status, indicator, pill
- Categories: status-indicators
- Status: general-availability
예시
import Lozenge from '@atlaskit/lozenge/lozenge';
const _default_1: React.JSX.Element[] = [
<Lozenge appearance="success">Done</Lozenge>,
<Lozenge appearance="inprogress" isBold>
In Progress
</Lozenge>,
];
export default _default_1;
Props
| Prop | Type | Description |
|---|---|---|
appearance |
"warning" | "default" | "removed" | "discovery" | "danger" | "neutral" | "success" | "information" | "inprogress" | "moved" | "new" | AccentColor |
The appearance of the lozenge |
children |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
Elements to be rendered inside the lozenge |
iconBefore |
React.ComponentClass<Omit<NewIconProps, "spacing">, any> | React.FunctionComponent<Omit<NewIconProps, "spacing">> |
Icon to display before the text content |
maxWidth |
string | number |
max-width of lozenge container |
spacing |
"default" | "spacious" |
Controls the overall spacing (padding + height) of the lozenge |
trailingMetric |
string |
Numeric metric displayed at the end of the lozenge as a badge |
trailingMetricAppearance |
"warning" | "default" | "removed" | "discovery" | "danger" | "neutral" | "success" | "information" | "inverse" | "inprogress" | "moved" | "new" |
Overrides the appearance of the trailing metric badge |
사용 지침
- 라벨이 의미 있는 속성을 전달할 때 로젠지를 사용해요: 상태, 시스템 상태, 우선순위, 권한, 또는 홍보 라벨.
- 라벨이 순수한 분류나 설명 메타데이터(주제, 속성, 그룹)일 때만 로젠지를 Tag로 전환해요.
- Tag에 기능이 없다고 해서 로젠지를 고르지 마요. 라벨의 의미에 맞는 컴포넌트를 골라요.
- 항상 색상을 간결하고 정확한 라벨과 함께 사용해요.
- 집계/점수에는 Badge를, 설명 메타데이터에는 Tag를 사용해요.
- 사용자가 드롭다운을 통해 상태를 전환하기 위해 로젠지를 클릭해야 한다면, 대신 LozengeDropdownTrigger를 사용해요. 이 컴포넌트는 상호작용형 상태 전환을 위해 만들어진 전용 컴포넌트예요.
- 사용자 주의가 필요한 곳에만 채워진(filled) 아이콘을 의도적으로 사용해요. 높은 우선순위나 워크플로 끝의 상태용으로 아껴 두어요.
- 채워진 아이콘을 남용하지 마요. 기본은 윤곽선(outlined) 아이콘이고, 중요하거나 심각한 상태를 나타낼 때만 채워진 아이콘을 사용해요.
콘텐츠 지침
- 명확하고 간결한 텍스트를 사용하고, 정확한 라벨(예: "오류", "경고")을 사용해요.
- 긴 텍스트에는 사용하지 마요. 로젠지는 포커스가 불가능하고 ~200px에서의 잘림은 접근성이 떨어져요.
- 텍스트가 의미 있고 설명적이도록 해요.
- 로젠지 사이에 일관된 용어를 사용해요.
접근성 지침
- 색상에만 의존하지 마요. 항상 정확한 텍스트 라벨과 함께 사용해요.
- 텍스트 가독성을 위해 충분한 색상 대비를 보장해요.
- 긴 텍스트에는 사용하지 마요. 잘림은 접근성이 떨어지고 로젠지는 포커스가 불가능해요.
- 스크린 리더에 적절한 라벨을 제공해요.
- 색상을 고를 때 색맹 사용자를 고려해요.
LozengeDropdownTrigger 컴포넌트
로젠지 드롭다운 트리거는 로젠지를 상호작용 가능하게 만들고, 선택을 갱신하기 위해 드롭다운을 여는 컴포넌트예요.
- Keywords: lozenge, dropdown, trigger, status, menu, interactive
- Categories: status-indicators
- Status: open-beta
예시
import LozengeDropdownTrigger from '@atlaskit/lozenge/lozenge-dropdown-trigger';
export default (): React.JSX.Element => (
<LozengeDropdownTrigger appearance="success">Success</LozengeDropdownTrigger>
);
Props
| Prop | Type | Description |
|---|---|---|
appearance |
"warning" | "default" | "removed" | "discovery" | "danger" | "neutral" | "success" | "information" | "inprogress" | "moved" | "new" | AccentColor |
The appearance of the lozenge |
aria-controls |
string |
Identifies the popup element that the trigger controls |
aria-expanded |
boolean |
Announces to assistive technology whether the popup is currently open or closed |
aria-haspopup |
boolean | "dialog" |
Informs assistive technology that this element triggers a popup |
aria-label |
string |
Defines a string value that labels the trigger element for assistive technology |
children |
string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
Elements to be rendered inside the lozenge |
iconBefore |
ComponentClass<Omit<NewIconProps, "spacing">, any> | FunctionComponent<Omit<NewIconProps, "spacing">> |
Icon to display before the text content |
isLoading |
boolean |
Whether the dropdown trigger is in a loading state |
isSelected |
boolean |
Whether the dropdown is currently selected/open |
maxWidth |
string | number |
max-width of lozenge container |
onClick |
(event: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void |
Callback fired when the trigger is clicked |
spacing |
"default" | "spacious" |
Controls the overall spacing (padding + height) of the lozenge |
trailingMetric |
string |
Numeric metric displayed at the end of the lozenge as a badge |
trailingMetricAppearance |
"warning" | "default" | "removed" | "discovery" | "danger" | "neutral" | "success" | "information" | "inverse" | "inprogress" | "moved" | "new" |
Overrides the appearance of the trailing metric badge |
사용 지침
- 상태 전환에 사용해요. 빠른 상태 변경을 허용하기 위해서만 드롭다운이나 팝업을 열어요.
- 버튼과 함께 표시할 때는 넉넉한(spacious) 크기를 사용해요.
- 추가 상태 세부 정보 같은 다른 정보를 전달하는 데는 사용하지 마요. 비상호작용 상태 표시에는 Lozenge를 사용해요.
콘텐츠 지침
- 명확하고 간결한 상태 라벨을 사용해요.
- 라벨을 짧게 유지해요. 최대 200px 너비는 잘림을 일으키고 로젠지는 포커스가 불가능해요.
- 색상만 사용하지 마요. 관련된 곳에는 명확한 라벨과 보조 아이콘을 사용해요.
접근성 지침
- 상태를 나타내기 위해 색상만 사용하지 마요. 명확한 라벨과 아이콘을 사용해요.
- 긴 라벨을 사용하지 마요. 로젠지는 포커스가 불가능해서 잘림이 접근성이 떨어져요.