Tooltip
A short label with an arrow shown on hover or focus, built on the Radix Tooltip primitive.
Preview
Drafts /Notes from the Lisbon offsite with Ines and Tomás
412 words
Summary — one line for the digest
Decisions
- Ship the export menu before the pricing page
- Malik owns the offline sync spike
Install
Add the editable source with the shadcn CLI. Your project also needs the shared theme tokens this component uses. Setup and requirements. The Pebble installer is not published yet.
npx shadcn@latest add https://pebbleui.com/r/tooltip.jsonProps
| Prop | Type | Default | Description |
|---|---|---|---|
| delayDuration | number | 300 | Hover delay in ms (TooltipProvider). |
| open | boolean | — | Controlled open state (root). |
| defaultOpen | boolean | false | Uncontrolled initial state (root). |
| onOpenChange | (open: boolean) => void | — | Called when the open state changes (root). |
| side | "top" | "right" | "bottom" | "left" | "top" | Preferred side (TooltipContent). |
| sideOffset | number | 6 | Gap in px from the trigger (TooltipContent). |
Build notes
Radix `Tooltip` provides delay grouping, placement and ARIA. The bubble is an inverted surface (`bg-foreground text-background`) so it reads against both the page and cards in either theme. The arrow is Radix's own `Tooltip.Arrow` SVG (10 x 5 px) filled with `fill-foreground`, so it inherits the bubble colour and follows the placed side automatically. Because the open states are `delayed-open` / `instant-open`, the entrance animation is the base `motion-safe:animate-[tooltip-in_120ms_ease-out]` and only the `data-[state=closed]` exit (`tooltip-out`, 80 ms ease-in) is state-keyed. Keyframes in the registry item `css` field animate opacity plus scale 0.96 to 1 from `--radix-tooltip-content-transform-origin`. Default delay is 300 ms (shadcn uses 0) so tips do not flash when the pointer passes over. Forced colors add a `CanvasText` border and fill the arrow with `CanvasText`. **Pebble (2026-11-03).** The bubble is now a small lit key, the same object as the primary button: `bg-linear-to-b from-key-top to-key-bottom text-primary-foreground`, `ring-1 ring-key-edge` and `shadow-[var(--key-shine),var(--elevation-md)]`, at `rounded-lg px-2.5 py-1.5`. Like the key it inverts in dark mode (light key, dark text). A flat arrow fill would mismatch the gradient, so the content carries `group/tooltip` and the arrow fills with `key-bottom` (tip above the trigger, arrow at the bottom edge) or `key-top` when `data-side="bottom"`. Timings move to tokens: `tooltip-in` at `--motion-base` / `--motion-enter`, `tooltip-out` at `--motion-fast` / `--motion-exit`, still `motion-safe:` only. Kbd's existing tooltip override (translucent `background` keys) sits on the lit surface unchanged. The demo is a document editor: a truncated filename with the full name in a bottom tip, collaborator avatars with name and status, a disabled Publish wrapped in a focusable span so its tip can explain why, and a `role="toolbar"` of `aria-pressed` formatting toggles whose tips show Kbd shortcuts. <!-- PEBBLE-LICENSE -->
View source
registry/overlay/tooltip/tooltip.tsx
"use client";
/* PEBBLE-LICENSE
Built by Pebble. Component: tooltip.
First-party license: MIT
The following first-party terms apply only to original Pebble material.
MIT License
Copyright (c) 2026 Praxys Solutions LLC (Pebble)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIRD-PARTY NOTICES
These notices apply to identified upstream portions; Pebble terms do not replace or narrow their rights.
Upstream: https://raw.githubusercontent.com/shadcn-ui/ui/main/LICENSE.md
MIT License
Copyright (c) 2023 shadcn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
END PEBBLE-LICENSE */
import * as React from "react";
import { Tooltip as TooltipPrimitive } from "radix-ui";
import { cn } from "@/lib/utils";
export function TooltipProvider({
delayDuration = 300,
...props
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
return (
<TooltipPrimitive.Provider
data-slot="tooltip-provider"
delayDuration={delayDuration}
{...props}
/>
);
}
export function Tooltip(props: React.ComponentProps<typeof TooltipPrimitive.Root>) {
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
}
export function TooltipTrigger(props: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
}
export function TooltipContent({
className,
sideOffset = 6,
children,
...props
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
return (
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
// A small lit key: the same inverted gradient, edge and shine as the
// primary button, so the tip reads as one object with the page.
"group/tooltip z-50 w-fit max-w-xs rounded-lg px-2.5 py-1.5 text-xs leading-snug font-medium text-balance",
"bg-linear-to-b from-key-top to-key-bottom text-primary-foreground shadow-[var(--key-shine),var(--elevation-md)] ring-1 ring-key-edge",
"forced-colors:border forced-colors:border-[CanvasText]",
"origin-(--radix-tooltip-content-transform-origin)",
// Radix uses delayed-open / instant-open, so the entrance is the
// base animation and the closed state overrides it.
"motion-safe:animate-[tooltip-in_var(--motion-base)_var(--motion-enter)]",
"motion-safe:data-[state=closed]:animate-[tooltip-out_var(--motion-fast)_var(--motion-exit)]",
className,
)}
{...props}
>
{children}
<TooltipPrimitive.Arrow
data-slot="tooltip-arrow"
width={10}
height={5}
// The arrow meets the gradient's near end: bottom stop for a tip
// above the trigger, top stop for one below it.
className="-mt-px fill-key-bottom group-data-[side=bottom]/tooltip:fill-key-top forced-colors:fill-[CanvasText]"
/>
</TooltipPrimitive.Content>
</TooltipPrimitive.Portal>
);
}
