Skip to content

Add TooltipHoverCard component#24

Open
KirklandGee wants to merge 6 commits intoWebflow-Examples:mainfrom
KirklandGee:add/tooltip-hover-card
Open

Add TooltipHoverCard component#24
KirklandGee wants to merge 6 commits intoWebflow-Examples:mainfrom
KirklandGee:add/tooltip-hover-card

Conversation

@KirklandGee
Copy link
Copy Markdown

Component: TooltipHoverCard

Description

A versatile tooltip and hover card component that displays contextual information when hovering over or focusing on a trigger element. Supports two modes: simple plain text tooltips and rich hover cards with title, description, and optional image. Features configurable placement (top, bottom, left, right) with automatic viewport edge detection and flip behavior. Includes a visual arrow pointer that dynamically adjusts to point at the trigger element. Appears after a configurable hover delay and smoothly fades in/out with CSS transitions. Fully keyboard accessible with focus state support for screen readers and keyboard navigation.

What's Included

  • React component with scoped CSS (no Tailwind, no shadcn)
  • Colors via CSS site variables: var(--background-primary, #ffffff), etc.
  • Typography via inheritance: font-family: inherit; color: inherit;
  • Full prop surface (TooltipHoverCard.webflow.tsx) — 20+ props for developers/agencies
  • Simple prop surface (TooltipHoverCardSimple.webflow.tsx) — core text/link props for clients
  • All CSS classes prefixed with wf-tooltip-hover-card- for Shadow DOM safety

Testing

  • npm install && npm run dev runs locally
  • npx webflow library share imports successfully
  • Full and simple prop surfaces render in Webflow canvas
  • Site variables wire up correctly

Generated component following the Webflow code components scaffold pattern.
Includes full and simple prop surface variations.
@KirklandGee
Copy link
Copy Markdown
Author

Screenshots

Light Theme

!Light

Dark Theme

!Dark

Brand Theme

!Brand

@KirklandGee
Copy link
Copy Markdown
Author

Screenshots

Light Theme

!Light

Dark Theme

!Dark

Brand Theme

!Brand

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 4, 2026

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 4, 2026

Caution

Review the following alerts detected in dependencies.

According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. It is recommended to resolve "Warn" alerts too. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Block Medium
Recently published: npm @dotenvx/dotenvx published 3 hours ago

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/@dotenvx/dotenvx@1.61.2

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@dotenvx/dotenvx@1.61.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm axios published 2 hours ago

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/axios@1.15.2

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/axios@1.15.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm electron-to-chromium published 6 hours ago

Location: Package overview

From: ?npm/@vitejs/plugin-react@5.2.0npm/@webflow/webflow-cli@1.14.0npm/electron-to-chromium@1.5.341

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/electron-to-chromium@1.5.341. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm jsonfile published yesterday

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/jsonfile@6.2.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/jsonfile@6.2.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm tapable published 7 hours ago

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/tapable@2.3.3

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tapable@2.3.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm caniuse-lite under CC-BY-4.0

Location: Package overview

From: ?npm/@vitejs/plugin-react@5.2.0npm/@webflow/webflow-cli@1.14.0npm/caniuse-lite@1.0.30001788

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001788. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm lodash under CC0-1.0 AND MIT

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/lodash@4.18.1

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/lodash@4.18.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm memfs under Unlicense

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/memfs@3.6.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/memfs@3.6.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm vite

Location: Package overview

From: tooltip-hover-card/package.jsonnpm/vite@7.3.2

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/vite@7.3.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Dynamic code execution: npm async-generator-function

Eval Type: Function

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/async-generator-function@1.0.0

ℹ Read more on: This package | This alert | What is dynamic code execution?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Avoid packages that use dynamic code execution like eval(), since this could potentially execute any code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/async-generator-function@1.0.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Dynamic code execution: npm generator-function

Eval Type: Function

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/generator-function@2.0.1

ℹ Read more on: This package | This alert | What is dynamic code execution?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Avoid packages that use dynamic code execution like eval(), since this could potentially execute any code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/generator-function@2.0.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Dynamic code execution: npm glob-to-regex.js

Eval Type: Function

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/glob-to-regex.js@1.2.0

ℹ Read more on: This package | This alert | What is dynamic code execution?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Avoid packages that use dynamic code execution like eval(), since this could potentially execute any code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/glob-to-regex.js@1.2.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Deprecated by its maintainer: npm koa-compose

Reason: koa-compose@4.2.0 is a breaking version, please either use <= v4.1 or upgrade to v5.x once it is released

From: ?npm/@webflow/webflow-cli@1.14.0npm/koa-compose@4.2.0

ℹ Read more on: This package | This alert | What is a deprecated package?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/koa-compose@4.2.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Deprecated by its maintainer: npm memfs with reason "this will be v4"

Reason: this will be v4

From: ?npm/@webflow/webflow-cli@1.14.0npm/memfs@3.6.0

ℹ Read more on: This package | This alert | What is a deprecated package?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/memfs@3.6.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

KirklandGee and others added 4 commits March 4, 2026 15:56
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Multiple compounding problems kept the tooltip invisible in the Webflow
canvas:

- position: fixed + getBoundingClientRect put the tooltip at viewport
  coordinates, but Webflow renders components inside Shadow DOM inside
  an iframe, and any transformed ancestor changes the containing block
  for fixed-positioned children. Net effect: the tooltip rendered, but
  often well off-screen relative to the visible canvas.
- cardImage typed as string, but props.Image returns {src, alt} — the
  <img src={cardImage}> produced [object Object] as the URL.
- cardDescription fed to dangerouslySetInnerHTML — Webflow's RichText
  runtime value is a React slot element, not an HTML string, so __html
  received an object and rendered nothing.
- cardDescription had no defaultValue, so the slot was empty out of the
  box.

Rewrite:

- Drop position: fixed and the JS position/arrow math entirely. The
  wrapper is now position: relative and the content uses position:
  absolute with CSS placement classes (top / bottom / left / right),
  sized to the wrapper's own box. No more viewport-coordinate drift.
- Keep auto-flip with a much smaller effect: when visible, measure
  overflow against the viewport and swap the placement class if
  needed — no continuous resize/scroll listeners.
- Retype cardImage as PropValues[PropType.Image] and render
  cardImage.src / cardImage.alt.
- Retype cardDescription as React.ReactNode and render it with
  {cardDescription}; add a plain-text defaultValue on the RichText
  prop so the card isn't blank by default.
- Re-derive the arrow from the content's background via a rotated
  square so it inherits theme colors automatically — no more
  per-theme, per-placement border-color rules.
- Hover card mode keeps pointer-events on the content so users can
  click links and interact; tooltip mode keeps pointer-events: none.
- Move the outer-hover handlers onto the wrapper for hoverCard mode so
  the card stays open while moving between trigger and card.

Also: vite/client types in tsconfig for *.css type-checking, and
update main.tsx's cardImage to the object shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Conditionally rendering with {isVisible && <content>} was remounting the
content every open, which (combined with the mount-time CSS animation
and the mouseenter/leave split across trigger button and wrapper) left
subsequent hovers in a state where the state toggled but the content
didn't visibly appear. Two changes:

- Always render the content, toggle visibility with a single
  wf-tooltiphovercard--open class on the wrapper and an opacity +
  visibility transition on the content. No remounting, animation stays
  intact on every open.
- Consolidate hover handling on the wrapper only. That handles both
  tooltip and hoverCard modes uniformly, and fixes the hoverCard mode
  case where moving the cursor from the trigger button onto the card
  (sibling, not child) was firing the button's mouseleave and hiding
  the card mid-transit. Small 120ms hide grace period in hoverCard
  mode lets the cursor cross the gap between trigger and card without
  the card collapsing.

Also split the single timeoutRef into show/hide refs so a scheduled
show and a scheduled hide can't stomp on each other.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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