Skip to content

Commit

Permalink
Allow slots to override text content
Browse files Browse the repository at this point in the history
  • Loading branch information
GiantRobots committed Sep 12, 2024
1 parent 8d238c3 commit 094658d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/lib/holocene/tooltip.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,14 @@
<Story name="Right" args={{ right: true }} />

<Story name="Right with Icon" args={{ right: true, icon: 'trash' }} />

<Story name="With Content instead of text">
<Tooltip bottomRight show>
<div slot="content">
<div>whadup</div>
<div>whadup</div>
<div>whadup</div>
</div>
<Button>Tooltip</Button>
</Tooltip>
</Story>
6 changes: 4 additions & 2 deletions src/lib/holocene/tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@
>
<div class="inline-block rounded-lg bg-slate-800 px-2 py-2">
<div class="flex gap-2 text-slate-100">
{#if icon}<Icon name={icon} class="inline h-4 text-white" />{/if}
<span>{text}</span>
<slot name="content">
{#if icon}<Icon name={icon} class="inline h-4 text-white" />{/if}
<span>{text}</span>
</slot>
</div>
</div>
</div>
Expand Down

0 comments on commit 094658d

Please sign in to comment.