Skip to content

feat(animated-tooltip): add accessible animated tooltip with customiz…#77

Merged
pras75299 merged 2 commits into
mainfrom
feat/tooltip
Jun 9, 2026
Merged

feat(animated-tooltip): add accessible animated tooltip with customiz…#77
pras75299 merged 2 commits into
mainfrom
feat/tooltip

Conversation

@pras75299

@pras75299 pras75299 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Type

  • New component / block (registry)
  • CLI change (init / add / list / info / doctor / search / shadcn JSON)
  • Docs site (apps/www)
  • Build / scripts / CI
  • Bug fix
  • Refactor / chore

Summary

Adds animated-tooltip — a self-contained, spring-animated tooltip for wrapping a single focusable trigger (button, link, icon button). It follows the WAI-ARIA tooltip pattern (role="tooltip", aria-describedby while open, hover + keyboard focus, Escape to dismiss) and supports independent styling of bubble background, text, and pointing arrow across all four sides with start/center/end alignment.

Why: fills a common overlay primitive in the library with motion-first polish and audited accessibility metadata, installable via npx uniqueui add animated-tooltip.

Highlights

  • useReducedMotion — spring scale/translate in default mode; opacity-only fade when reduced motion is preferred
  • Configurable side, align, background, color, arrowColor, arrow, arrowSize, offset, delay, disabled, className
  • Show timer + Escape listener cleaned up on unmount
  • Decorative arrow is aria-hidden

Screenshots / video (UI changes only)

N/A in PR — verify on the component docs page after merge.

Test plan

  • pnpm test — turbo: all 4 workspace packages pass
  • pnpm build:registry — succeeds; syncs apps/www/components/ui/animated-tooltip.tsx, public registry, and shadcn r/* artifacts
  • pnpm --filter uniqueui-cli build — not run; no CLI source changes
  • Manually verified in apps/www dev server — not run in this session

Additional checks

  • pnpm test:repo — 66 passed
  • pnpm --dir apps/www test — 92 passed (component-sync includes new slug)
  • pnpm registry:validate — 66 entries, 66 shadcn items OK
  • pnpm check:reduced-motion — 58 motion components covered (includes animated-tooltip)

New component checklist

Registry sources

  • registry/animated-tooltip/component.tsx created
  • registry/components/animated-tooltip.json created — registry + docs blocks, metadata (tags, peerDependencies, compatibility, accessibility, motion, changelog)
  • Slug added to order and docsOrder in registry/manifest.json
  • Demo added — registry/animated-tooltip/demo.tsx + "animated-tooltip" in registry/demos/demo-key-order.json; import in registry/demos/shared.tsx
  • pnpm build:registry run — generated apps/www/public/registry/*, apps/www/public/r/*, and apps/www/components/ui/animated-tooltip.tsx committed

Component quality gate (Section I from backlogs.md)

  • "use client" at top (hooks, Motion, DOM events)
  • Accepts className and merges via cn
  • Props typed via AnimatedTooltipProps; trigger cloned with aria-describedby
  • Uses motion from motion/react; spring enter/exit
  • Honors useReducedMotion with opacity-only fallback
  • No layout shift on mount — tooltip only renders when open (AnimatePresence)
  • setTimeout and keydown listener cleaned up on unmount/blur
  • SSR-safe — no module-scope window/document; document only in open-state effect
  • Keyboard operable — focus shows tooltip; Escape dismisses; arrow aria-hidden
  • No cross-imports between registry components
  • At least one render test — not added (no animated-tooltip entry in apps/www/tests/* yet)

Related issues

New component — no linked issue.

Install: npx uniqueui add animated-tooltip

Commits (1)

Commit Message
8112abc feat(animated-tooltip): add accessible animated tooltip with customizable arrow

Summary by CodeRabbit

New Features

  • Added a new Tooltip component with customizable placement (top/bottom/left/right), theming (background, text, arrow colors), optional arrow display, configurable delay and offset, keyboard dismissal, and reduced-motion support. Fully accessible and compatible with any trigger element type.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
uniqueui-platform Ready Ready Preview, Comment Jun 9, 2026 7:38am

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pras75299, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 44 minutes and 3 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 537f9243-1464-4a41-bc90-984305907046

📥 Commits

Reviewing files that changed from the base of the PR and between 8112abc and 895bf09.

📒 Files selected for processing (8)
  • apps/www/components/ui/animated-tooltip.tsx
  • apps/www/public/r/animated-tooltip.json
  • apps/www/public/registry.json
  • apps/www/public/registry/animated-tooltip.json
  • apps/www/public/registry/changelogs.json
  • registry.json
  • registry/animated-tooltip/component.tsx
  • registry/components/animated-tooltip.json
📝 Walkthrough

Walkthrough

This PR introduces a new AnimatedTooltip component to the UniqueUI component library. The implementation includes state management for delayed show/hide, accessibility wiring via aria-describedby, optional animated arrow rendering, and reduced-motion support. The component is registered across both the source registry and public CDN registry systems with complete documentation, demos, and cross-references.

Changes

AnimatedTooltip Component

Layer / File(s) Summary
Component Implementation (Props, Helpers, Core Logic)
registry/animated-tooltip/component.tsx, apps/www/components/ui/animated-tooltip.tsx
AnimatedTooltipProps defines configurable placement, colors, arrow, delay, and disabled modes. Helper functions getLayoutStyle and getArrowStyle compute absolute positioning and rotation. The AnimatedTooltip component manages open state with delayed show on hover/focus, immediate hide on blur/mouseLeave, and Escape dismissal. It clones the trigger to add aria-describedby when visible, animates via motion/react with reduced-motion fallback, and renders the tooltip bubble with role="tooltip" and optional rotated arrow.
Demo and Usage Examples
registry/animated-tooltip/demo.tsx, apps/www/config/demos.tsx
Demo entry component showcases tooltip placement (top/right/bottom/left), custom background/text/arrow colors, arrow-disabled variant, rich JSX content, Info icon trigger, and anchor link trigger with themed underline styling.
Core Registry Definitions
registry/components/animated-tooltip.json, apps/www/public/r/animated-tooltip.json, apps/www/public/registry/animated-tooltip.json
Adds registry metadata including dependencies (motion, clsx, tailwind-merge), full prop schema, usage code examples, comprehensive docs with multiple configuration scenarios, peer dependencies, compatibility tags (React 18+, Next 14+, Tailwind 3+/4+), accessibility/motion notes, and version/changelog tracking.
Configuration and Icon Integration
apps/www/config/components.ts, apps/www/public/r/registry.json, apps/www/public/registry.json, apps/www/config/docs-scenarios.ts
Integrates MessageSquare Lucide icon into icon maps, adds animated-tooltip component definition with metadata to config registries, defines doc scenarios with themed, placement, arrowless, and rich-content examples.
Registry Metadata and Ordering
registry/manifest.json, registry/demos/demo-key-order.json, registry/demos/shared.tsx, apps/www/public/registry/index.json, apps/www/public/registry/changelogs.json
Updates demo and docs ordering in manifest files to position animated-tooltip after hero-flow-field, adds it to public registry indexes, imports the component and Info icon in demo shared utilities, and adds initial 1.0.0 changelog entry dated 2026-06-08.
Cross-Component References
registry.json, apps/www/public/registry/animated-tabs.json, apps/www/public/registry/morphing-modal.json, apps/www/public/registry/drawer-slide.json, apps/www/public/registry/notification-stack.json, apps/www/public/registry/multi-step-auth-card.json
Adds "animated-tooltip" to relatedSlugs arrays in five existing component registry entries and registry.json, wiring the new tooltip as a discoverable related component alongside animated-tabs, morphing-modal, drawer-slide, notification-stack, and multi-step-auth-card.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

A tooltip appears on hover so bright, 🎀
With arrows that dance and reduced-motion just right,
From registry to demo, each file in its place,
Our rabbit-built component brings UI grace! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: adding a new accessible animated tooltip component with customizable arrow.
Description check ✅ Passed The PR description is comprehensive and follows the template structure. It includes type selection, detailed summary, test plan with checkmarks, completed component quality gate checklist, and new component checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tooltip

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
registry.json (1)

4202-4202: ⚡ Quick win

Expose wrapper HTML/motion props on AnimatedTooltipProps for registry consistency.

AnimatedTooltipProps is currently standalone, so consumers cannot pass common wrapper props (id, data-*, aria-*, etc.) in a typed way. Please extend the relevant HTML/motion props interface and omit conflicting handlers/props to match the registry component contract.

As per coding guidelines, "Extend the relevant HTML/motion props interface and omit conflicting event handlers in TypeScript components."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@registry.json` at line 4202, AnimatedTooltipProps must allow standard wrapper
HTML/motion props but currently doesn't; update the AnimatedTooltipProps type to
extend the appropriate element props (e.g.,
React.HTMLAttributes<HTMLSpanElement>) and motion props (e.g., MotionProps or
Partial<MotionProps>) while Omit-ing/conflicting handlers used internally
(onMouseEnter, onMouseLeave, onFocus, onBlur, and aria-describedby) so consumers
can pass id/data-*/aria-* etc.; then accept a rest props parameter in the
AnimatedTooltip function signature and spread those remaining props onto the
outer wrapper span (and/or appropriate motion span) so external attributes are
forwarded without overriding the component's internal event handlers (refer to
AnimatedTooltipProps, AnimatedTooltip, and the outer wrapper span/motion.span
usage).

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/www/components/ui/animated-tooltip.tsx`:
- Around line 176-178: The cloneElement call for trigger currently overwrites
any existing aria-describedby; update the logic in the React.cloneElement usage
(where trigger is created from children and tooltipId is used) to merge IDs
instead of replacing: read the child's existing aria-describedby
(children.props['aria-describedby'] or attributes), split into unique IDs,
append tooltipId only when open, join with spaces, and when closed restore the
original IDs or set undefined if none remain; ensure types/casting around
React.HTMLAttributes<HTMLElement> are handled safely so the merged string is
assigned to aria-describedby.

In `@registry/animated-tooltip/component.tsx`:
- Around line 176-178: The clone of the trigger element (created in
React.cloneElement within the trigger variable) overwrites any existing
aria-describedby instead of merging IDs; change the logic to read the trigger's
existing aria-describedby from children.props (or existingAttrs), split it into
ID tokens, add tooltipId when open (ensuring no duplicates), and when closed
remove the tooltipId leaving other IDs intact, then pass the merged string (or
undefined if empty) as the aria-describedby prop to React.cloneElement so other
descriptions are preserved.

---

Nitpick comments:
In `@registry.json`:
- Line 4202: AnimatedTooltipProps must allow standard wrapper HTML/motion props
but currently doesn't; update the AnimatedTooltipProps type to extend the
appropriate element props (e.g., React.HTMLAttributes<HTMLSpanElement>) and
motion props (e.g., MotionProps or Partial<MotionProps>) while
Omit-ing/conflicting handlers used internally (onMouseEnter, onMouseLeave,
onFocus, onBlur, and aria-describedby) so consumers can pass id/data-*/aria-*
etc.; then accept a rest props parameter in the AnimatedTooltip function
signature and spread those remaining props onto the outer wrapper span (and/or
appropriate motion span) so external attributes are forwarded without overriding
the component's internal event handlers (refer to AnimatedTooltipProps,
AnimatedTooltip, and the outer wrapper span/motion.span usage).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18ba8eee-413e-4c81-bcc5-c5fc1d19d97c

📥 Commits

Reviewing files that changed from the base of the PR and between 770d920 and 8112abc.

📒 Files selected for processing (22)
  • apps/www/components/ui/animated-tooltip.tsx
  • apps/www/config/components.ts
  • apps/www/config/demos.tsx
  • apps/www/config/docs-scenarios.ts
  • apps/www/public/r/animated-tooltip.json
  • apps/www/public/r/registry.json
  • apps/www/public/registry.json
  • apps/www/public/registry/animated-tabs.json
  • apps/www/public/registry/animated-tooltip.json
  • apps/www/public/registry/changelogs.json
  • apps/www/public/registry/drawer-slide.json
  • apps/www/public/registry/index.json
  • apps/www/public/registry/morphing-modal.json
  • apps/www/public/registry/multi-step-auth-card.json
  • apps/www/public/registry/notification-stack.json
  • registry.json
  • registry/animated-tooltip/component.tsx
  • registry/animated-tooltip/demo.tsx
  • registry/components/animated-tooltip.json
  • registry/demos/demo-key-order.json
  • registry/demos/shared.tsx
  • registry/manifest.json

Comment thread apps/www/components/ui/animated-tooltip.tsx
Comment thread registry/animated-tooltip/component.tsx
@pras75299 pras75299 merged commit 9545b92 into main Jun 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant