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

@atlaskit/tooltip

원문 보기 위키 갱신

툴팁(Tooltip)은 UI 요소나 기능을 설명하는 데 사용하는, 동작하지 않는 떠 있는 라벨이에요.

출처: 문서

본문

Tooltip 컴포넌트

툴팁은 사용자 인터페이스 요소나 기능을 설명하는, 동작하지 않는 떠 있는 라벨이에요.

  • Keywords: tooltip, hint, hover, help, floating, label, explanation
  • Categories: overlays-and-layering
  • Status: general-availability

예시

import Button from '@atlaskit/button/default/button';
import Tooltip from '@atlaskit/tooltip/Tooltip';
export default function DefaultTooltipExample(): React.JSX.Element {
	return (
		<Tooltip content="This is a tooltip" testId="default-tooltip">
			{(tooltipProps) => <Button {...tooltipProps}>Hover over me</Button>}
		</Tooltip>
	);
}

Props

Prop Type Description
canAppear () => boolean Whether or not the tooltip can be displayed
children React.ReactNode | ((props: TriggerProps) => React.ReactNode) Elements to be wrapped by the tooltip (required)
component React.ComponentType<TooltipPrimitiveProps> | React.ForwardRefExoticComponent<Omit<TooltipPrimitiveProps, "ref"> & React.RefAttributes<HTMLDivElement>> Extend TooltipPrimitive to create your own tooltip and pass it as component
content React.ReactNode | (({ update }: { update?: () => void; }) => React.ReactNode) The content of the tooltip (required)
delay number Time in milliseconds to wait before showing and hiding the tooltip
hideTooltipOnClick boolean Hide the tooltip when the click event is triggered
hideTooltipOnMouseDown boolean Hide the tooltip when the mousedown event is triggered
ignoreTooltipPointerEvents boolean Adds pointer-events: none to the tooltip itself
isScreenReaderAnnouncementDisabled boolean By default tooltip content will be duplicated into a hidden element so
it can be read out by a screen reader
mousePosition AutoPlacement | BasePlacement | VariationPlacement Where the tooltip should appear relative to the mouse pointer
onHide (analyticsEvent: UIAnalyticsEvent) => void Function to be called when the tooltip will be hidden
onShow (analyticsEvent: UIAnalyticsEvent) => void Function to be called when the tooltip will be shown
position Placement | PositionMouseOptions Where the tooltip should appear relative to its target
shortcut string[] Display a keyboard shortcut in the tooltip
shouldAlwaysFadeIn boolean When set to true, the tooltip will always use the fade-in animation
and never use the show-immediate behavior, even when another tooltip
is already visible
shouldRenderToParent boolean When enabled, the tooltip will be rendered as a sibling to the trigger element instead of being portaled to the document body
strategy "fixed" | "absolute" Use this to define the strategy of popper
tag keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement> & { ref: React.Ref<HTMLElement>; }> | React.ForwardRefExoticComponent<...> Replace the wrapping element

사용 지침

  • 상호작용 가능한 요소에만 사용해요 (키보드와 스크린 리더가 포커스할 수 있어야 해요).
  • 호버나 포커스 시 열리며, 콘텐츠는 텍스트만 사용해요.
  • 아이콘 버튼의 라벨, 유용하지만 필수는 아닌 정보(예: 단축키), 잘림이 불가피한 잘린 텍스트에 사용해요.
  • 비활성화된 요소에는 절대 사용하지 마요 (Button a11y 참고).
  • 툴팁에 중요한 정보를 넣지 마요—라벨, 도움말 텍스트, 인라인 메시지를 사용해요.
  • 툴팁 안에 상호작용하거나 시각적인 콘텐츠를 넣지 마요 (링크/버튼/아이콘 없음)—Popup이나 Modal을 사용해요.
  • 더 풍부하거나 긴 콘텐츠에는 Inline message를, 상호작용 콘텐츠에는 Popup/Modal을 사용해요.

콘텐츠 지침

  • 간결하게 유지하고, 보이는 라벨을 반복하지 마요.
  • 유용하지만 필수가 아닌 정보만 사용해요.
  • 아이콘 버튼과 링크 아이콘 버튼은 자체적인 콘텐츠 지침이 있어요.

접근성 지침

  • 상호작용 가능한 요소에만 사용해요 (키보드 포커스 가능, 스크린 리더가 접근 가능).
  • 비활성화된 요소에는 툴팁을 절대 사용하지 마요.
  • 툴팁에 중요한 정보를 넣지 마요—보이는 라벨, 도움말 텍스트, 인라인 메시지를 사용해요.
  • 툴팁 안에 링크, 버튼, 아이콘을 넣지 마요—상호작용 콘텐츠에는 Popup이나 Modal을 사용해요.
  • 툴팁에 표시된 키보드 단축키는 보조 기술에 노출되지 않아요—대안(예: 패널, 다이얼로그)을 제공해요.
  • 툴팁 콘텐츠가 스크린 리더에 안내되도록 보장해요.
  • 키보드 접근을 제공해요 (호버 + 포커스 트리거).

더 알아보기 (Learn more)