Free pack

Tooltip <mv-tooltip>

최상위 레이어(Popover API)에 표시되는 툴팁입니다. 뒤집기를 포함한 자동 배치, 화살표, 그룹 지연을 지원합니다.

작동 방식

최상위 레이어(Popover API)에 표시되는 툴팁으로, flip을 포함한 자동 배치, 화살표, 그룹 지연을 지원합니다. 툴바에서는 Tooltip Group이 버튼에서 버튼으로 미끄러지는 단일 표면을 공유합니다.

카테고리오버레이
유형Web Component (<mv-tooltip>)
상태안정
Keywordstooltip, hint, popover, morphic-tooltip

When to use

  • An icon-only button needs its label shown on hover and keyboard focus
  • A short supplementary hint clarifies a control without cluttering the layout

Avoid when

  • The content is interactive or must be reachable on touch devices → use Popover instead
  • Many adjacent toolbar buttons should share one gliding tooltip surface → use Tooltip Group instead
  • The preview is rich, such as a profile card with an avatar and details → use Hover Card instead

설치

node scripts/add.mjs tooltip --out ./src/marvelous

Marvelous UI MCP 서버를 사용하는 AI 에이전트: install_components({ slugs: ["tooltip"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).

복사되는 파일(의존성 포함): tokens/tokens.css, core/base.css, core/dom.js, core/element.js, core/position.js, components/tooltip/tooltip.js, components/tooltip/tooltip.css.

사용법

기본 마크업입니다. 여기서 시작해 속성, data-*, CSS 변수로 커스터마이즈하세요:

<div style="display:flex;gap:.75rem;flex-wrap:wrap;justify-content:center">
  <mv-tooltip text="Above" placement="top"><button class="mv-button" data-variant="outline">Top</button></mv-tooltip>
  <mv-tooltip text="Below" placement="bottom"><button class="mv-button" data-variant="outline">Bottom</button></mv-tooltip>
  <mv-tooltip text="To the left" placement="left"><button class="mv-button" data-variant="outline">Left</button></mv-tooltip>
  <mv-tooltip text="To the right" placement="right"><button class="mv-button" data-variant="outline">Right</button></mv-tooltip>
  <mv-tooltip placement="top" delay="0">
    <button class="mv-button" data-variant="secondary">Rich</button>
    <div data-content><strong>⌘ K</strong>: open the palette</div>
  </mv-tooltip>
</div>

API

Attributes

Name유형DefaultDescription
textstringPlain text (otherwise a [data-content] child).
placementtop | bottom | left | right[-start|-end]topPreferred side, flipped when there’s no room.
delaynumber500Show delay (ms). Skipped if another tooltip just closed.
offsetnumber8Distance from the trigger (px).
openbooleanOpens/closes programmatically.
disabledbooleanDisables the tooltip.

Events

NameDescription
mv-openAfter opening.
mv-closeAfter closing.

Content structure

NameDescription
first childTrigger (button, link, focusable icon).
[data-content]Optional rich content.

CSS variables

NameDescription
--mv-tooltip-bgBackground.
--mv-tooltip-fgText.

Accessibility

role=tooltip + aria-describedby on the trigger; opens on keyboard focus, closes on Escape. Doesn’t open on touch (use a Popover).

이 페이지는 AI로 번역되었습니다. 번역 문제 신고