본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

플래그

원문 보기 위키 갱신

플래그 (Flag)

플래그는 사용자에게 짧은 메시지를 표시하는 컴포넌트예요. 작업의 성공, 경고, 오류 같은 결과를 사용자가 놓치지 않도록 화면 한쪽 모서리에 떠 있는 알림 형태로 보여줘요.

출처: 문서

본문

Flag 컴포넌트

짧은 메시지를 표시하는 컴포넌트예요.

  • 키워드: flag, message, success, notification, alert, toast
  • 카테고리: feedback
  • 상태: general-availability

예시

import Flag from '@atlaskit/flag/flag';
import FlagGroup from '@atlaskit/flag/flag-group';
import InfoIcon from '@atlaskit/icon/core/status-information';
const Examples = (): React.JSX.Element => (
	<>
		<FlagGroup>
			<Flag
				id="flag-1"
				icon={<InfoIcon label="Info" />}
				title="Success"
				description="Your changes have been saved successfully."
				appearance="success"
			/>
		</FlagGroup>
		<FlagGroup>
			<Flag
				id="flag-2"
				icon={<InfoIcon label="Warning" />}
				title="Warning"
				description="This action cannot be undone."
				appearance="warning"
				actions={[
					{
						content: 'Proceed',
						onClick: () => console.log('Proceed clicked'),
					},
				]}
			/>
		</FlagGroup>
		<FlagGroup>
			<Flag
				id="flag-3"
				icon={<InfoIcon label="Error" />}
				title="Error"
				description="Something went wrong. Please try again."
				appearance="error"
				actions={[
					{
						content: 'Retry',
						onClick: () => console.log('Retry clicked'),
					},
				]}
			/>
		</FlagGroup>
	</>
);
export default Examples;

Props

Prop Type Description
actions ActionType[] Array of clickable actions to be shown at the bottom of the flag
appearance "warning" | "success" | "error" | "normal" | "info" Makes the flag appearance bold
autoDismissSeconds number Duration in seconds before flag gets auto dismissed
delayAnnouncement number Milliseconds to delay the screen reader announcement due to announcement conflict
description string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal The secondary content shown below the flag title
headingLevel 1 | 2 | 3 | 4 | 5 | 6 Specifies the heading level in the document structure
icon string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal The icon displayed in the top-left of the flag
id string | number A unique identifier used for rendering and onDismissed callbacks (required)
linkComponent React.ComponentClass<CustomThemeButtonProps, any> | React.FunctionComponent<CustomThemeButtonProps> A link component that is passed down to the @atlaskit/button used by actions,
to allow custom routers to be used
onBlur (e: React.FocusEvent<HTMLElement, Element>, analyticsEvent: UIAnalyticsEvent) => void Standard onBlur event, applied to Flag by AutoDismissFlag
onDismissed (id: string | number, analyticsEvent: UIAnalyticsEvent) => void Handler which will be called when a Flag's dismiss button is clicked
onFocus (e: React.FocusEvent<HTMLElement, Element>, analyticsEvent: UIAnalyticsEvent) => void Standard onFocus event, applied to Flag by AutoDismissFlag
onMouseOut (event: React.MouseEvent<Element, MouseEvent>) => void Standard onMouseOut event, applied to Flag by AutoDismissFlag
onMouseOver (event: React.MouseEvent<Element, MouseEvent>) => void Standard onMouseOver event, applied to Flag by AutoDismissFlag
title string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal The bold text shown at the top of the flag (required)

사용 지침

  • 최소한의 상호작용만 필요한 확인이나 알림에 사용해요
  • 왼쪽 하단에 배치하며, 콘텐츠 위에 겹쳐 표시해요
  • 기본(default): 닫기 가능하고 이벤트 기반이에요 (예: 아바타 업데이트). 굵게(bold): 닫기 불가능하고 심각도 기반이에요 (success/loading/warning/error), 접힘/펼침 지원
  • 심각하거나 시스템 메시지에는 Banner, 조치가 필요한 경우에는 Inline message, 즉각적인 조치가 필요하면 Modal을 사용해요

콘텐츠 지침

  • 오류의 경우 무엇이 잘못됐는지 명확히 전달해요
  • 문제를 해결하기 위한 구체적인 단계를 제시해요
  • 도움이 되고 위협적이지 않은 어조를 사용해요
  • 경고의 경우 잠재적 결과를 명확히 언급해요
  • 성공 메시지에서는 결과를 확인한 뒤 사용자를 방해하지 않도록 해요
  • 정보(Information): 알려주기만 하고 별도의 조치는 필요 없어요
  • 경고(Warning): 조치 전에 공감을 보이고 대안을 제시해요
  • 오류(Error): 무엇이 잘못됐는지와 다음 단계를 설명하고, "you"가 아닌 "we"를 사용해요
  • 성공(Success): 결과를 확인한 뒤 사용자를 방해하지 않도록 하고, 세부 내용을 볼 수 있는 옵션을 제공해요
  • 명확하고 간결하게 작성하며, 도움이 되고 위협적이지 않은 어조를 사용해요

접근성 지침

  • 줌 및 긴 단어를 고려해 문구를 간결하게 유지해요
  • headingLevel prop을 통해 제목에 h2를 사용하고, 제목 계층을 유지해요
  • 닫기 가능한 플래그와 닫기 불가능한 플래그를 함께 쌓지 마세요
  • 심각도를 색상만으로 전달하지 마세요
  • 막다른 길을 피하세요 — 항상 진행 방법을 알려줘요
  • 중요한 메시지에는 자동 닫기(auto-dismiss)를 사용하지 마세요
  • 목적지를 설명하는 설명적인 링크 텍스트를 사용해요
  • 플래그 콘텐츠가 스크린 리더로 안내되도록 해요
  • 스크린 리더 안내 충돌을 고려해요

더 알아보기 (Learn more)