Dot Morph
A picture made of dots that rearranges into a second picture, with text that appears over it once the dots land.
pixikit.com/docs/components/dot-morph
Customize
Trigger
Dot size4px
Gap3px
Color
Duration700ms
Stagger240ms
Props
14| Name | Type | Default | Description |
|---|---|---|---|
from | string[] | Required | The picture at rest: one string per row; `#` solid, `o` ring, `.` faint, space empty. |
to | string[] | Required | The picture the dots travel to, in the same format. |
trigger | "hover" | "inView" | "click" | "none" | "hover" | What morphs it: pointer or focus, entering the view, a click, or nothing. |
active | boolean | None | Controls the morph from outside; overrides the trigger. |
dotSize | number | 4 | A dot's diameter in pixels. |
gap | number | 3 | The space between dots, in pixels. |
color | string | "var(--primary)" | The dot colour; any CSS colour, theme variables included. |
duration | number | 700 | How long one dot travels, in milliseconds. |
stagger | number | 240 | How much later the dots farthest from the centre start, in milliseconds. |
slot | DotMorphSlot | None | The rectangle of the `to` picture, in cells, where `children` sits. |
children | ReactNode | None | Shown over the slot once the dots have landed, hidden at rest. |
ariaLabel | string | None | Describes the picture to assistive tech; without it the picture is hidden from it. |
onChange | (active: boolean) => void | None | Called when the morph switches on or off. |
className | string | None |