BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/jolyui/ui/vercel-tabs

vercel-tabs

jolyui-ui/vercel-tabs
FreeComponent

jolyui/ui publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by jolyui/ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://jolyui.dev/r/vercel-tabs.json

Source

ui/vercel-tabs.tsxjolyui.dev/r/vercel-tabs.json
1"use client";
2
3import type React from "react";
4import { useEffect, useRef, useState } from "react";
5import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
6
7interface TabData {
8 label: string;
9 value: string;
10 content: React.ReactNode;
11}
12
13interface VercelTabsProps {
14 tabs: TabData[];
15 defaultTab?: string;
16 className?: string;
17}
18
19export function VercelTabs({ tabs, defaultTab, className }: VercelTabsProps) {
20 const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
21 const [activeTab, setActiveTab] = useState(defaultTab || tabs[0]?.value);
22 const [hoverStyle, setHoverStyle] = useState({});
23 const [activeStyle, setActiveStyle] = useState({ left: "0px", width: "0px" });
24 const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);
25
26 const activeIndex = tabs.findIndex((tab) => tab.value === activeTab);
27
28 useEffect(() => {
29 if (hoveredIndex !== null) {
30 const hoveredElement = tabRefs.current[hoveredIndex];
31 if (hoveredElement) {
32 const { offsetLeft, offsetWidth } = hoveredElement;
33 setHoverStyle({
34 left: `${offsetLeft}px`,
35 width: `${offsetWidth}px`,
36 });
37 }
38 }
39 }, [hoveredIndex]);
40
41 useEffect(() => {
42 const activeElement = tabRefs.current[activeIndex];
43 if (activeElement) {
44 const { offsetLeft, offsetWidth } = activeElement;
45 setActiveStyle({
46 left: `${offsetLeft}px`,
47 width: `${offsetWidth}px`,
48 });
49 }
50 }, [activeIndex]);
51
52 useEffect(() => {
53 requestAnimationFrame(() => {
54 const activeElement = tabRefs.current[activeIndex];
55 if (activeElement) {
56 const { offsetLeft, offsetWidth } = activeElement;
57 setActiveStyle({
58 left: `${offsetLeft}px`,
59 width: `${offsetWidth}px`,
60 });
61 }
62 });
63 }, [activeIndex]);
64
65 return (
66 <Tabs
67 defaultValue={activeTab}
68 onValueChange={setActiveTab}
69 className={`flex w-full flex-col items-center ${className}`}
70 >
71 <TabsList className="relative h-auto select-none gap-[6px] bg-transparent p-0">
72 {/* Hover Highlight */}
73 <div
74 className="absolute top-0 left-0 flex h-[30px] items-center rounded-[6px] bg-[#0e0f1114] transition-all duration-300 ease-out dark:bg-[#ffffff1a]"
75 style={{
76 ...hoverStyle,
77 opacity: hoveredIndex !== null ? 1 : 0,
78 }}
79 />
80
81 {/* Active Indicator */}
82 <div
83// … truncated

Files it writes

  • ui/vercel-tabs.tsx

Facts

Registry
jolyui/ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on jolyui/ui jolyui.dev Johuniq/jolyui on GitHub Raw registry item This item as JSON

More from jolyui/ui

All 199 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
ai-prompt-boxai-prompt-boxjolyui/uiComponentsFree4 deps
animated-beamanimated-beamjolyui/uiComponentsFree1 dep
animated-tableanimated-tablejolyui/uiComponentsFree2 deps
animated-theme-toggleanimated-theme-togglejolyui/uiComponentsFree2 deps
animated-toastanimated-toastjolyui/uiComponentsFree2 deps
animated-tooltipanimated-tooltipjolyui/uiComponentsFree1 dep
bento-gridbento-gridjolyui/uiComponentsFreeno deps
buttonbuttonjolyui/uiComponentsFree3 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex