+
+ `
};
-export const customDemo = {
+
+export const providerDemo = {
type: 'code',
code: `
-
- Custom Tooltip
-
-}>
-
-`
+
+
+
+ }>Tooltip 1
+ Top Left tooltip
+
+
+ }>Tooltip 2
+ Top Right tooltip
+
+
+ `
};
-export const providerDemo = {
+export const trackCursorDemo = {
type: 'code',
tabs: [
{
- name: 'With Provider',
+ name: 'Both',
code: `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- `
+
+ }>Hover me
+ Tooltip follows cursor
+ `
},
{
- name: 'Without Provider',
+ name: 'X',
code: `
-
-
-
-
-
-
-
-
-
-
-
-
-
- `
+
+ }>Hover me
+ Tooltip follows cursor
+ `
+ },
+ {
+ name: 'Y',
+ code: `
+
+ }>Hover me
+ Tooltip follows cursor
+ `
}
]
};
+
+export const arrowDemo = {
+ type: 'code',
+ code: `
+
+ }>Hover me
+ Tooltip with arrow
+ `
+};
diff --git a/apps/www/src/content/docs/components/tooltip/index.mdx b/apps/www/src/content/docs/components/tooltip/index.mdx
index bd0485b06..d1a309373 100644
--- a/apps/www/src/content/docs/components/tooltip/index.mdx
+++ b/apps/www/src/content/docs/components/tooltip/index.mdx
@@ -4,7 +4,7 @@ description: A popup that displays information related to an element when it rec
source: packages/raystack/components/tooltip
---
-import { playground, sideDemo, customDemo,followCursorDemo, providerDemo } from "./demo.ts";
+import { playground, sideDemo, alignDemo, customDemo, providerDemo, trackCursorDemo, noArrowDemo, arrowDemo } from "./demo.ts";
@@ -20,9 +20,21 @@ The Tooltip component accepts various props to customize its behavior and appear
+## Tooltip.Trigger Props
+
+The Trigger component wraps the element that activates the tooltip.
+
+
+
+## Tooltip.Content Props
+
+The Content component displays the tooltip content and controls positioning.
+
+
+
## Tooltip.Provider Props
-The TooltipProvider component serves as a context wrapper that provides global configuration and functionality to all tooltip instances within your application.
+The Provider component serves as a context wrapper that provides global configuration and functionality to all tooltip instances within your application.
@@ -30,10 +42,16 @@ The TooltipProvider component serves as a context wrapper that provides global c
### Side
-The Tooltip component can be positioned in different directions using the `side` prop:
+The Tooltip Content component can be positioned in different directions using the `side` prop:
+### Align
+
+The Tooltip Content component can be aligned in different directions using the `align` prop:
+
+
+
### Custom Content
Tooltips can contain custom content using ReactNode:
@@ -46,18 +64,14 @@ The TooltipProvider component can be used to provide a global configuration for
-### Follow Cursor
+### Track Cursor
-When `followCursor` is true, the tooltip will follow the cursor and will be positioned relative to the cursor.
+Use `trackCursorAxis` prop on the Root component to make the tooltip follow the cursor:
-
+
-## Accessibility
+### With Arrow
-The Tooltip component follows WAI-ARIA guidelines for tooltips:
+Show the arrow by setting `showArrow={true}` on the Content component:
-- Uses `role="tooltip"` for proper semantic meaning
-- Automatically manages focus and hover interactions
-- Supports keyboard navigation
-- Provides appropriate ARIA attributes for accessibility
-- Manages enter/exit animations for smooth user experience
+
diff --git a/apps/www/src/content/docs/components/tooltip/props.ts b/apps/www/src/content/docs/components/tooltip/props.ts
index 41c94f013..7f3111747 100644
--- a/apps/www/src/content/docs/components/tooltip/props.ts
+++ b/apps/www/src/content/docs/components/tooltip/props.ts
@@ -1,95 +1,101 @@
export interface TooltipProps {
/**
- * Content to display in the tooltip.
+ * The controlled open state of the tooltip.
*/
- message: string | React.ReactNode;
+ open?: boolean;
/**
- * Element that triggers the tooltip.
+ * The initial open state of the tooltip.
*/
- children: React.ReactNode;
+ defaultOpen?: boolean;
/**
- * Position of the tooltip relative to the trigger.
- * @default "top"
+ * Event handler called when the open state of the tooltip changes.
*/
- side?:
- | 'top'
- | 'right'
- | 'bottom'
- | 'left'
- | 'top-left'
- | 'top-right'
- | 'bottom-left'
- | 'bottom-right';
+ onOpenChange?: (open: boolean) => void;
/**
- * Whether the tooltip should follow the cursor.
- * @default false
+ * Delay before showing the tooltip, in milliseconds.
+ * @default 200
*/
- followCursor?: boolean;
+ delayDuration?: number;
/**
- * Whether the tooltip is disabled.
- * @default false
+ * Prevents Tooltip from remaining open when hovering. Disabling this has accessibility consequences.
*/
- disabled?: boolean;
+ disableHoverableContent?: boolean;
/**
- * The controlled open state of the tooltip.
+ * Track cursor axis ('none', 'x', 'y', or 'both')
+ * @default 'none'
*/
- open?: boolean;
+ trackCursorAxis?: 'none' | 'x' | 'y' | 'both';
+}
+export interface TooltipTriggerProps {
/**
- * The initial open state of the tooltip.
+ * React element to render as the trigger. Props will be merged onto this element.
*/
- defaultOpen?: boolean;
+ render?: React.ReactElement;
/**
- * Event handler called when the open state of the tooltip changes.
+ * Additional CSS class names
+ */
+ className?: string;
+}
+
+export interface TooltipContentProps {
+ /**
+ * Controls whether to show the arrow
* @default false
*/
- onOpenChange?: (open: boolean) => void;
+ showArrow?: boolean;
/**
- * Delay before showing the tooltip, in milliseconds.
- * Overrides the prop of TooltipProvider.
- * @default 200
+ * Side placement of the tooltip
+ * @default "top"
*/
- delayDuration?: number;
+ side?: 'top' | 'bottom' | 'left' | 'right';
/**
- * Prevents Tooltip from remaining open when hovering. Disabling this has accessibility consequences.
- * Overrides the prop of TooltipProvider.
+ * Alignment of the tooltip
+ * @default "center"
*/
- disableHoverableContent?: boolean;
+ align?: 'start' | 'center' | 'end';
+
+ /**
+ * Side offset for positioning
+ * @default 4
+ */
+ sideOffset?: number;
/**
- * Additional ID for Tooltip Content
+ * Align offset for positioning
+ * @default 0
*/
- id?: string;
+ alignOffset?: number;
/**
- * Additional CSS class names.
+ * Additional CSS class names
*/
className?: string;
}
export interface TooltipProviderProps {
/**
- * Delay before showing the tooltip, in milliseconds.
+ * How long to wait before opening a tooltip. Specified in milliseconds.
* @default 200
*/
- delayDuration?: number;
+ delay?: number;
/**
- * Delay before showing the tooltip when moving between tooltips, in milliseconds.
- * @default 200
+ * How long to wait before closing a tooltip. Specified in milliseconds.
*/
- skipDelayDuration?: number;
+ closeDelay?: number;
/**
- * Prevents Tooltip from remaining open when hovering. Disabling this has accessibility consequences.
+ * Another tooltip will open instantly if the previous tooltip is closed within this timeout. Specified in milliseconds.
+ * @default 400
*/
- disableHoverableContent?: boolean;
+ timeout?: number;
}
diff --git a/packages/raystack/components/sidebar/sidebar-root.tsx b/packages/raystack/components/sidebar/sidebar-root.tsx
index 463d44a2a..b30915ebf 100644
--- a/packages/raystack/components/sidebar/sidebar-root.tsx
+++ b/packages/raystack/components/sidebar/sidebar-root.tsx
@@ -62,48 +62,48 @@ export const SidebarRoot = forwardRef(
-
-