Skip to content
Effects Fancy Stable

DimSiblings

.md

Wraps a group of cards, links, or list items so hovering or keyboard-focusing one dims (or blurs) every other one — a pure CSS :has() affordance with zero pointer-tracking JavaScript

Available for Svelte 5, React, and Vue 3.

Preview

Installation

pnpm add fancy-ui-svelte
import { DimSiblings } from "fancy-ui-svelte";

Usage

svelte
<script lang="ts">
	import { DimSiblings } from "fancy-ui-svelte";

	const COLUMNS = [
		{ heading: "Product", links: ["Overview", "Pricing", "Changelog"] },
		{ heading: "Docs", links: ["Guides", "API reference", "Examples"] },
		{ heading: "Company", links: ["About", "Careers", "Blog"] },
		{ heading: "Legal", links: ["Privacy", "Terms", "Security"] },
	];
</script>

<div class="w-full p-6">
	<DimSiblings as="footer" class="grid grid-cols-2 gap-x-6 gap-y-6 sm:grid-cols-4">
		{#each COLUMNS as column}
			<div>
				<h3 class="text-foreground text-sm font-semibold">{column.heading}</h3>
				<ul class="mt-3 flex flex-col gap-2">
					{#each column.links as link}
						<li>
							<a
								href="#{link.toLowerCase().replace(/\s+/g, '-')}"
								class="text-muted-foreground hover:text-foreground text-sm">{link}</a
							>
						</li>
					{/each}
				</ul>
			</div>
		{/each}
	</DimSiblings>
	<p class="text-muted-foreground mt-4 text-xs">
		Hover any link, or Tab to it — the other three columns dim so the one you're in stands out.
	</p>
</div>

Examples

Basic Usage

With Blur

Blur non-active siblings in addition to dimming them.

Props

PropTypeDefaultDescription
effect "dim" | "blur" | "both""dim"Which visual property the non-active siblings lose
opacity number0.4Opacity the non-active siblings settle to — a floor, not zero
blur number2Blur radius in px, applied only when effect includes blur
duration number150Transition duration in ms for the opacity/blur change
as keyof HTMLElementTagNameMap"div"The rendered root element — "ul"/"ol" for a list whose CSS list semantics need to survive the wrapper
class string-Additional CSS classes
ref HTMLElement | nullnullBindable reference to the root element

Slots

SlotDescription
children The sibling group — every direct child participates