StealThis .dev
Patterns Medium

View Transition Grid Filter Identity

Filterable grid that preserves card identity while items reorder.

Open in Lab
view-transitionsfiltercssjs
Targets: JS HTML

Code

:root {
  --bg: #0a0f18;
  --panel: #131c2e;
  --line: #2a3751;
  --text: #eef4ff;
  --muted: #bfd0e8;
  --accent: #8de3ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 8%, rgba(88, 140, 255, 0.24), transparent 40%),
    radial-gradient(circle at 84% 80%, rgba(174, 90, 255, 0.22), transparent 42%),
    var(--bg);
}

.topbar {
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.topbar a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.support {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.support.ok { color: #aff0cc; }
.support.warn { color: #ffd6ad; }

main {
  width: min(1120px, 94%);
  margin: 0 auto 2.5rem;
}

.heading { display: grid; gap: 0.5rem; }
.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
}

h1, p { margin: 0; }
.heading p:last-child { color: var(--muted); }

.controls {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter {
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
}

.filter.active {
  border-color: rgba(141, 227, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(141, 227, 255, 0.38) inset;
}

.meta {
  margin-top: 0.75rem;
  color: var(--muted);
}

.grid {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02));
  padding: 0.85rem;
  display: grid;
  gap: 0.55rem;
}

.thumb {
  min-height: 120px;
  border-radius: 12px;
}

.tag {
  width: fit-content;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.74rem;
  color: #d9e7fb;
}

.card p {
  color: var(--muted);
  font-size: 0.92rem;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

View Transition Grid Filter Identity

Filterable grid that preserves card identity while items reorder.

Source

  • Repository: libs-gen
  • Original demo id: 17-view-transition-grid-filter

Notes

Filterable grid that preserves card identity while items reorder.