INFINITYUI
HomeComponentsDocsTemplates
Star

Getting Started

  • Introduction
  • Installation
  • CLI
  • Audit

Navigation

  • Spotlight Navbar
  • Glass DockNEW
  • Animated Tab Bar
  • Circle Menu
  • Magnet Tabs
  • Animated Sidebar
  • Apple Spotlight
  • Page TOC RailNEW

Text

  • Flip Text
  • Glitch Text
  • Liquid Text
  • Flip Fade Text
  • Mask Cursor Effect

Cards

  • Glow Border Card
  • Testimonials Card
  • Interactive Book
  • Trading CardsNEW
  • Hover Image
  • Chain of ThoughtNEW
  • Masonry Grid
  • Image Pile
  • Staggered Grid

Inputs

  • AI InputNEW
  • OTP Input
  • Leave Rating

Buttons

  • Social Flip Button
  • Creepy Button

Loaders

  • Jelly Loader
  • Rolling Ball Scroll
  • Glowing Scroll

Backgrounds

  • Light Lines
  • Perspective Grid
  • Liquid Ocean
  • Eagle Vision
  • Flow Scroll
  • Horizontal Scroll

Overlays

  • PersonaNEW
  • Infinite Moving Cards
  • Masked Avatars
  • Stacked Logos
  • Icon Wheel
  • Pixelated CarouselNEW
  • Pixelated Image Trail
  • Flip Scroll
  • Interactive Folder
  • Animated Folder IconNEW
  • Stack Scroll
  • Rubik Cube
Buttons

Social Flip Button

#button#social#flip

Hover each button

TwitterGithubDiscordFigmaLinkedin
implementedInfinityUI component

This component is fully implemented in InfinityUI and wired into the docs and registry flow.

Installation

Use the registry command to add the component source, and install any package dependencies if needed.

Infinity Registry

Install the component source into your project with the shadcn CLI.

npx shadcn@latest add https://infinityui-pearl.vercel.app/r/social-flip-button
Package Dependencies

Install the npm packages used by this component source.

npm install @iconify/react framer-motion

Component Code

Copy and paste this code into your component file.

tsx
"use client";

import { useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { Icon } from "@iconify/react";

interface SocialFlipButtonProps {
    platform: "twitter" | "github" | "discord" | "figma" | "linkedin";
    href?: string;
}

const config: Record<string, { icon: string; hoverIcon: string; label: string; hoverBg: string; hoverText: string }> = {
    twitter: { icon: "solar:twitter-linear", hoverIcon: "solar:twitter-bold", label: "Follow", hoverBg: "bg-sky-500", hoverText: "Follow" },
    github: { icon: "solar:github-circle-linear", hoverIcon: "solar:github-circle-bold", label: "Star", hoverBg: "bg-zinc-700", hoverText: "Star" },
    discord: { icon: "ic:baseline-discord", hoverIcon: "ic:baseline-discord", label: "Join", hoverBg: "bg-indigo-500", hoverText: "Join" },
    figma: { icon: "solar:figma-linear", hoverIcon: "solar:figma-bold", label: "Follow", hoverBg: "bg-orange-500", hoverText: "Follow" },
    linkedin: { icon: "mdi:linkedin", hoverIcon: "mdi:linkedin", label: "Connect", hoverBg: "bg-blue-600", hoverText: "Connect" },
};

export function SocialFlipButton({ platform, href = "#" }: SocialFlipButtonProps) {
    const [hovered, setIsHovered] = useState(false);
    const c = config[platform];

    return (
        <a
            href={href}
            target="_blank"
            rel="noopener noreferrer"
            aria-label={`${c.label} on ${platform}`}
            onMouseEnter={() => setIsHovered(true)}
            onMouseLeave={() => setIsHovered(false)}
            className={`relative flex items-center gap-2 px-4 py-2 rounded-xl border text-sm font-semibold overflow-hidden transition-all duration-300 ${hovered
                    ? `${c.hoverBg} border-transparent text-white shadow-lg scale-105`
                    : "bg-zinc-900 border-white/10 text-zinc-400"
                }`}
        >
            <motion.span animate={{ rotate: hovered ? 360 : 0 }} transition={{ duration: 0.3 }}>
                <Icon icon={hovered ? c.hoverIcon : c.icon} fontSize={18} />
            </motion.span>
            <AnimatePresence mode="wait">
                <motion.span
                    key={hovered ? "hover" : "default"}
                    initial={{ opacity: 0, y: 6 }}
                    animate={{ opacity: 1, y: 0 }}
                    exit={{ opacity: 0, y: -6 }}
                    transition={{ duration: 0.15 }}
                >
                    {hovered ? c.hoverText : platform.charAt(0).toUpperCase() + platform.slice(1)}
                </motion.span>
            </AnimatePresence>
        </a>
    );
}