Skip to content

Commit f7a3afe

Browse files
feat: initial refactored tooltip
1 parent f925a01 commit f7a3afe

File tree

8 files changed

+59
-0
lines changed

8 files changed

+59
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { component$ } from '@builder.io/qwik';
2+
import { Tooltip } from '@qwik-ui/headless';
3+
4+
export default component$(() => {
5+
return (
6+
<Tooltip.Root>
7+
<Tooltip.Trigger>Hover over me</Tooltip.Trigger>
8+
<Tooltip.Content>I'm a tooltip!</Tooltip.Content>
9+
</Tooltip.Root>
10+
);
11+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Qwik UI | Tooltip
3+
---
4+
5+
# Tooltip
6+
7+
<Showcase name="hero" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { component$, useSignal } from '@builder.io/qwik';
2+
import { Toggle } from '@qwik-ui/headless';
3+
4+
export default component$(() => {
5+
const toggleChecked = useSignal(false);
6+
return <Toggle pressed={toggleChecked.value} />;
7+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { HTooltipRoot as Root } from './tooltip-root';
2+
export { HTooltipContent as Content } from './tooltip-content';
3+
export { HTooltipTrigger as Trigger } from './tooltip-trigger';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Slot, component$ } from '@builder.io/qwik';
2+
import { HPopoverPanel } from '../popover/popover-panel';
3+
4+
export const HTooltipContent = component$(() => {
5+
return (
6+
<HPopoverPanel>
7+
<Slot />
8+
</HPopoverPanel>
9+
);
10+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Slot, component$ } from '@builder.io/qwik';
2+
import { HPopoverRoot } from '../popover/popover-root';
3+
4+
export const HTooltipRoot = component$(() => {
5+
return (
6+
<HPopoverRoot hover>
7+
<Slot />
8+
</HPopoverRoot>
9+
);
10+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Slot, component$ } from '@builder.io/qwik';
2+
import { HPopoverTrigger } from '../popover/popover-trigger';
3+
4+
export const HTooltipTrigger = component$(() => {
5+
return (
6+
<HPopoverTrigger>
7+
<Slot />
8+
</HPopoverTrigger>
9+
);
10+
});

packages/kit-headless/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ export * from './components/separator';
1414
export * as Tabs from './components/tabs';
1515
export { Toggle } from './components/toggle';
1616
export * from './utils/visually-hidden';
17+
export * as Tooltip from './components/tooltip';

0 commit comments

Comments
 (0)