Command Palette

Search for a command to run...

Docs
Magnetic Tabs

Magnetic Tabs

Tab component with magnetic hover effects and smooth indicator animations

Loading...

Installation

Usage

import MagneticTabs from "@/components/ruixen/magnetic-tabs";
 
const tabItems = [
  { value: "overview", label: "Overview", content: "Overview content here." },
  { value: "activity", label: "Activity", content: "Activity content here." },
  { value: "settings", label: "Settings", content: "Settings content here." },
  { value: "faq", label: "FAQ", content: "FAQ content here." },
];
 
export default function App() {
  return (
    <MagneticTabs
      items={tabItems}
      defaultValue="overview"
      indicatorPadding={6}
    />
  );
}

Props

PropTypeDefaultDescription
itemsMagneticTabItem[]Default itemsArray of tab items
defaultValuestring"overview"Default active tab value
classNamestring""Additional CSS classes
indicatorPaddingnumber6Padding around tab for magnetic indicator

Features

  • Magnetic Effect: Indicator follows mouse hover and active state
  • Smooth Animations: Spring-based transitions for natural feel
  • Responsive: Automatically adjusts to tab size changes
  • Blur Effect: Subtle blur effect on the magnetic indicator

Types

interface MagneticTabItem {
  value: string;
  label: string;
  content?: React.ReactNode;
}