Sibling Dimming
blaze-motion/sibling-dimmingFreeComponent
Sibling dimming — hovering one item dims every non-hovered sibling to 50%. Pure CSS.
Install it
npx shadcn@latest add https://motion.asmitsah.dev/r/sibling-dimming.jsonSource
1import type { ComponentPropsWithoutRef, CSSProperties } from "react";2import { feel } from "@/lib/motion";3import { cn } from "@/lib/utils";45// Container: when it HAS a hovered item, every non-hovered item dims to 50%.6// `:not(:hover)` keeps the hovered item untouched, so there's no self-hover7// specificity race. Pair with SiblingDimmingItem (adds the `.dim-item` marker).8export function SiblingDimming({ className, ...props }: ComponentPropsWithoutRef<"div">) {9 return (10 <div11 className={cn("[&:has(.dim-item:hover)_.dim-item:not(:hover)]:opacity-50", className)}12 {...props}13 />14 );15}1617const dimTransition: CSSProperties = {18 transitionDuration: `${feel.duration.fast}s`,19 transitionTimingFunction: `cubic-bezier(${feel.ease.join(",")})`,20};2122export function SiblingDimmingItem({23 className,24 style,25 ...props26}: ComponentPropsWithoutRef<"div">) {27 return (28 <div29 className={cn("dim-item transition-opacity motion-reduce:transition-none", className)}30 style={{ ...dimTransition, ...style }}31 {...props}32 />33 );34}
What it pulls in
npm packages
Other registry items
Files it writes
More from blaze-motion
All 19 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Cinematic Imagecinematic-image | blaze-motion | Components | Free | 1 dep | |
| Clip Revealclip-reveal | blaze-motion | Components | Free | 1 dep | |
| Fadefade | blaze-motion | Components | Free | 1 dep | |
| Grayscale Revealgrayscale-reveal | blaze-motion | Components | Free | 1 dep | |
| Grow from Origingrow-from-origin | blaze-motion | Components | Free | 1 dep | |
| Inset Frame Revealinset-frame-reveal | blaze-motion | Components | Free | 1 dep | |
| Line Revealline-reveal | blaze-motion | Components | Free | 1 dep | |
| Mask Text Revealmask-text-reveal | blaze-motion | Components | Free | 1 dep |
