---
components: ["Tooltip", "TooltipFooter"]
---

<script>
  import { Tooltip, TooltipFooter, Link, Button } from "carbon-components-svelte";
  import Catalog from "carbon-icons-svelte/lib/Catalog.svelte";
  import Preview from "../../components/Preview.svelte";
</script>

`Tooltip` displays contextual information when users hover over or focus on an element. It supports various directions, alignments, and interactive content to provide additional context or guidance.

## Default

Display a tooltip triggered by the default information icon.

<Tooltip>
  <p>
    Resources are provisioned based on your account's organization.
  </p>
</Tooltip>

## With trigger text

Use custom trigger text instead of the default icon.

<Tooltip triggerText="Resource list">
  <p>
    Resources are provisioned based on your account's organization.
  </p>
</Tooltip>

## Reactive example

Control the tooltip state programmatically.

<FileSource src="/framed/Tooltip/TooltipReactive" />

## Directions

Position the tooltip in different directions using the `direction` prop.

<Tooltip triggerText="Top" direction="top"><p>Top</p></Tooltip>
<Tooltip triggerText="Right" direction="right"><p>Right</p></Tooltip>
<Tooltip triggerText="Bottom" direction="bottom"><p>Bottom</p></Tooltip>
<Tooltip triggerText="Left" direction="left"><p>Left</p></Tooltip>

## Alignment

Align the tooltip content using the `align` prop.

<Tooltip triggerText="Start" align="start"><p>Start</p></Tooltip>
<Tooltip triggerText="End" align="end"><p>End</p></Tooltip>
<Tooltip triggerText="Center" align="center"><p>Center</p></Tooltip>

## Interactive

Add interactive elements like links and buttons using `TooltipFooter`.

<Tooltip triggerText="Resource list">
  <p>
    Resources are provisioned based on your account's organization.
  </p>
  <TooltipFooter selectorPrimaryFocus="#d">
    <Link href="/">Learn more</Link>
    <Button id="d" size="small">Manage</Button>
  </TooltipFooter>
</Tooltip>

## Custom icon (component)

Use a custom icon component with the `icon` prop.

<Tooltip triggerText="Resource list" icon={Catalog}>
  <p>
    Resources are provisioned based on your account's organization.
  </p>
</Tooltip>

## Custom icon (slot)

Customize the icon using the `icon` slot for more flexibility.

<Tooltip triggerText="Resource list">
  <div slot="icon" style="width: 1rem; height: 1rem; outline: 1px solid red;"></div>
  <p>
    Resources are provisioned based on your account's organization.
  </p>
</Tooltip>

## Hidden icon

Hide the icon while keeping the tooltip functionality using `hideIcon`.

<Tooltip hideIcon triggerText="Resource list">
  <p>
    Resources are provisioned based on your account's organization.
  </p>
</Tooltip>