BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/100xui/motion-dock

Motion Dock

100xui/motion-dock
FreeBlock

A reusable component where tooltips slide smoothly between dock items, making the motion dock feel natural and easy to use.

Live preview

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

Install it

npx shadcn@latest add https://100xui.com/r/motion-dock.json

Source

registry/100xui/blocks/motion-dock/components/motion-dock.tsx100xui.com/r/motion-dock.json · first 6 KB
1"use client";
2
3import React from "react";
4import {
5 useAnimate,
6 motion,
7 AnimatePresence,
8 usePresence,
9 useMotionValue,
10 type Transition,
11 type AnimationPlaybackControlsWithThen,
12 type HTMLMotionProps,
13} from "motion/react";
14import { cn } from "@/lib/utils";
15
16import { usePrevious } from "@/hooks/use-previous";
17import { useDebouncedState } from "@/hooks/use-debounced-state";
18
19interface DockItem extends Omit<HTMLMotionProps<"button">, "ref"> {
20 icon: React.ReactElement;
21 tooltip: string;
22}
23
24export interface MotionDockProps extends React.ComponentProps<"div"> {
25 dockItems: DockItem[];
26 tooltipBorderRadius?: React.CSSProperties["borderRadius"];
27}
28const TRANSITION: Transition = {
29 duration: 0.2,
30 ease: [0.76, 0, 0.24, 1], // easeInOutQuart
31};
32export function MotionDock({
33 dockItems,
34 className,
35 tooltipBorderRadius = "var(--radius-sm)",
36 ...rest
37}: MotionDockProps) {
38 const [activeItem, setActiveItem] = useDebouncedState<number>(-1, 100);
39 const dockRef = React.useRef<HTMLDivElement>(null);
40
41 const handleReset = () => setActiveItem(-1);
42
43 return (
44 <div className={cn(className, "!relative !w-fit")} {...rest}>
45 <div
46 ref={dockRef}
47 className="bg-background text-foreground border-border flex gap-0.5 rounded-full border p-1 shadow-sm"
48 onMouseLeave={handleReset}
49 onBlurCapture={handleReset}
50 >
51 {dockItems.map(
52 ({ icon, tooltip, onMouseEnter, onFocus, className, ...rest }, i) => (
53 <motion.button
54 key={tooltip}
55 aria-label={tooltip}
56 onFocus={(e) => {
57 setActiveItem(i);
58 onFocus?.(e);
59 }}
60 onMouseEnter={(e) => {
61 setActiveItem(i);
62 onMouseEnter?.(e);
63 }}
64 data-dockitem={i}
65 className={cn(
66 "hover:text-accent-foreground hover:bg-accent focus-visible:text-accent-foreground focus-visible:bg-accent focus-visible:ring-ring focus-visible:ring-offset-background cursor-pointer rounded-full p-1.5 transition-colors duration-150 ease-out focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-none",
67 className
68 )}
69 {...rest}
70 >
71 {icon}
72 </motion.button>
73 )
74 )}
75 </div>
76 <AnimatePresence>
77 {activeItem >= 0 && (
78 <ToolTipsContainer
79 activeItem={activeItem}
80// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • registry/100xui/blocks/motion-dock/components/motion-dock.tsx
  • registry/100xui/shared/hooks/use-debounced-state.ts
  • registry/100xui/shared/hooks/use-previous.ts

Facts

Registry
100xui
Type
registry:block
Access
Free
Files written
3
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
2 days ago

Go to the source

Docs on 100xui 100xui.com YashwantOstwal/100xUI on GitHub Raw registry item This item as JSON

More from 100xui

All 14 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Apple galleryapple-gallery100xuiBlocksFree1 dep
Chat bento cardchat-bento-card100xuiBlocksFree1 dep
demosdemos100xuiBlocksFreeno deps · 12 files
In-page navbarin-page-navbar100xuiBlocksFree1 dep · 2 files
internalsinternals100xuiBlocksFreeno deps · 4 files
iPhone 3D mockupiphone-3d-mockup100xuiBlocksFreeno deps
Menu wheelmenu-wheel100xuiBlocksFree1 dep
Morph modalmorph-modal100xuiBlocksFree1 dep
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