Skip to content

Conversation

@kumarayushkumar
Copy link

@kumarayushkumar kumarayushkumar commented Nov 4, 2025

What

Updates input and tooltip components to the latest shadcn/ui versions that include dark: variant styles for improved dark mode support.

Changes

  • Updated input component with latest dark mode variants (dark:bg-input/30, etc.)
  • Updated tooltip component to latest version
  • Ensures preview panel accurately reflects latest shadcn/ui component styles

Fixes #231

Summary by CodeRabbit

  • Refactor

    • Reorganized Input and Tooltip UI components with improved structural consistency.
  • Style

    • Enhanced Input component with additional style tokens, focus states, and accessibility variants.
    • Updated Tooltip styling and default spacing configuration.

@vercel
Copy link

vercel bot commented Nov 4, 2025

@kumarayushkumar is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Walkthrough

The Input and Tooltip components were refactored from forwardRef-based wrappers to plain function components. Input removes ref forwarding and adds data-slot attribute with expanded classNames. Tooltip replaces static aliases with explicit functions, adding TooltipProvider composition, data-slot attributes, and adjusting default sideOffset from 4 to 0.

Changes

Cohort / File(s) Summary
Input Component Refactor
components/ui/input.tsx
Converted from React.forwardRef to plain function component. Removed ref support and displayName. Added data-slot="input" attribute. Expanded className with additional style tokens including focus and aria variants for enhanced styling.
Tooltip Component Refactor
components/ui/tooltip.tsx
Replaced static Radix Tooltip aliases with explicit functional components. TooltipProvider now configures delayDuration (default 0) and forwards props. Tooltip, TooltipTrigger, and TooltipContent are now functions with data-slot attributes. TooltipContent default sideOffset changed from 4 to 0 and now renders Portal/Content composition with Arrow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Ref forwarding removal in Input: Verify that removing ref support doesn't break existing consumers relying on ref-based access to the underlying input element.
  • TooltipProvider composition change: Ensure the new wrapping pattern in Tooltip doesn't introduce unexpected nesting or provider lifecycle issues.
  • Default sideOffset change: Confirm the sideOffset default value change from 4 to 0 aligns with intended design and doesn't cause visual regressions.
  • Data-slot attributes: Verify these new attributes don't conflict with existing styling or testing selectors.

Poem

🐰 Plain functions hop where refs once roamed,
Data slots mark each component's home,
Tooltips nest with provider care,
Input feels light without a ref to bear,
Shadcn's latest style, now darkly fair!

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: update shadcn input and tooltip to latest versions' accurately describes the main changes, which involve updating both components.
Linked Issues check ✅ Passed The PR updates both input and tooltip components with dark mode variants and structural improvements aligning with the latest shadcn versions as requested in issue #231.
Out of Scope Changes check ✅ Passed All changes are scoped to updating input.tsx and tooltip.tsx components to match latest shadcn versions, directly addressing issue #231's requirements.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 240f7cd and b1415a2.

📒 Files selected for processing (2)
  • components/ui/input.tsx (1 hunks)
  • components/ui/tooltip.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/ui/tooltip.tsx (1)
lib/utils.ts (1)
  • cn (6-8)
components/ui/input.tsx (1)
lib/utils.ts (1)
  • cn (6-8)
🔇 Additional comments (6)
components/ui/input.tsx (2)

1-3: LGTM!

Imports are correct and appropriate for the component.


5-19: LGTM! Changes align with PR objectives.

The Input component correctly implements the latest shadcn/ui patterns:

  • Removal of forwardRef is appropriate for React 19, where ref is now a regular prop.
  • Dark mode variants are present (dark:bg-input/30, dark:aria-invalid:ring-destructive/40).
  • The data-slot="input" attribute aligns with modern shadcn/ui component architecture.
components/ui/tooltip.tsx (4)

1-6: LGTM!

The "use client" directive and imports are correct for a Radix UI-based tooltip component.


8-19: LGTM!

TooltipProvider correctly wraps the Radix primitive. The delayDuration={0} default provides immediate tooltip display, which aligns with modern UI expectations.


31-35: LGTM!

TooltipTrigger is correctly implemented with the data-slot attribute.


37-59: LGTM! Changes align with PR objectives.

TooltipContent correctly implements the latest patterns:

  • sideOffset={0} default (changed from previous value) for tighter positioning
  • Includes TooltipPrimitive.Arrow for the tooltip pointer
  • Animation classes and color tokens provide proper styling
  • The implementation supports dark mode through semantic color tokens (bg-foreground, text-background)

Comment on lines +21 to +29
function Tooltip({
...props
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
return (
<TooltipProvider>
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
</TooltipProvider>
)
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify this pattern matches the latest shadcn/ui implementation.

The Tooltip component embeds its own TooltipProvider, creating a new provider per tooltip instance. This differs from the typical Radix UI pattern where a single TooltipProvider wraps the application root and multiple tooltips share it.

Implications:

  • Users cannot share provider configuration across multiple tooltips
  • Performance overhead with many tooltip instances (each creates a new React context provider)
  • Users cannot wrap TooltipProvider at a higher level to configure all tooltips globally

Action required:
Please verify this matches the latest shadcn/ui tooltip implementation. If this is indeed the new pattern, consider documenting it for users migrating from older versions.


🌐 Web query:

Latest shadcn/ui tooltip component implementation pattern TooltipProvider usage

💡 Result:

Short answer — wrap your Tooltip(s) with TooltipProvider at a high level (usually near App/layout) and use the Tooltip + TooltipTrigger + TooltipContent primitives for each tooltip. Example (official pattern):

import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip"

function App() {
return (



Hover me


Tooltip text





)
}

Notes:

  • TooltipProvider gives global defaults (timing/behavior) for nested tooltips; place it near your app root or layout. [1][2]
  • Use TooltipTrigger asChild when you want the trigger to be the child element without extra wrapper. [1]

Sources: official shadcn/ui docs. [1] UI docs (latest site) (ui.shadcn.com) [2] v3 docs / examples. (v3.shadcn.com)

Citations:



Fix: Remove embedded TooltipProvider and align with official shadcn/ui pattern.

The current implementation wraps each Tooltip instance with its own TooltipProvider, which deviates from the official shadcn/ui pattern where TooltipProvider should be placed near your app root or layout and multiple tooltips share it.

Issues with current pattern:

  • Creates unnecessary React context overhead (one provider per tooltip instead of one shared provider)
  • Prevents users from configuring provider behavior globally via a single TooltipProvider
  • Does not match the official usage pattern where a single TooltipProvider wraps multiple Tooltip + TooltipTrigger + TooltipContent instances

Remove the embedded TooltipProvider from the Tooltip component and expect users to place TooltipProvider at a high level in their application tree (or document this custom pattern with an explicit reason if this deviation is intentional).

🤖 Prompt for AI Agents
components/ui/tooltip.tsx around lines 21 to 29: the Tooltip component currently
wraps each instance in its own TooltipProvider which creates per-tooltip context
overhead and deviates from the shadcn/ui pattern; remove the embedded
TooltipProvider and have Tooltip simply forward props to TooltipPrimitive.Root
so that a single TooltipProvider can be placed at the app root or layout and
shared by all Tooltip instances; update any docs/comments to instruct consumers
to wrap their app/layout with TooltipProvider if they need global tooltip
configuration.

@kumarayushkumar
Copy link
Author

@jnsahaj please let me what need to be fixed in this PR

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.

Tweakcn preview panel components are not up to date with the latest shadcn components for dark mode

1 participant