Compact View Icon

Six dots in a 3×2 grid that reorder via Motion layout animation when active, signaling a compact view mode.

Installation

File Structure

compact-view-icon.tsx

Usage

import { useState } from "react";
import { CompactViewIcon } from "@/components/unlumen-ui/compact-view-icon";

export default function Example() {
  const [isActive, setIsActive] = useState(false);

  return (
    <button onClick={() => setIsActive((prev) => !prev)}>
      <CompactViewIcon isActive={isActive} />
    </button>
  );
}

API Reference

CompactViewIcon

isActive
boolean

When true, the six dots reorder from [0,1,2,3,4,5] to [1,2,5,0,3,4] via Motion layout animation.

className?
string

Extra classes applied to the root <span> element.

Notes

  • Uses Motion layout prop to animate each dot to its new grid position.
  • The active permutation groups the middle and right columns first, then the left column — giving a visual sense of density change.
  • Each dot has a staggered delay of 0.018 s × index for a flowing feel.
  • Set aria-label on the parent button to describe the action.

Credits

Built by leo.

Keep in mind

Most components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.