Data displayBeforeAfter

Open in Create
Search
astronomic.dev

BeforeAfter

Pro

To show a job's before and after photos: drag or use the arrow keys to compare. With no script, the two photos sit side by side.

File
BeforeAfter.astro
Group
Data display
Kind
Interactive: inline script
Examples
4
import BeforeAfter from "@astronomic/ui-pro/components/BeforeAfter.astro";

Examples

Drag the orange handle to set the width. Frames get real breakpoints.

  • Static
  • Interactive
  • Framed

Drag to compare

A kitchen remodel by Sixpenny Builders. Drag across the photo, or Tab to it and use the arrow keys (Home and End reach the ends). "All before" and "All after" show one photo in full, gliding there where motion is allowed.

main.astro

Beside the job's story

Tilth & Stone's front yard next to its words, as on a service page. focalPoint keeps the house in view as the stage crops both photos.

landscaping.astro

Starting at 80

defaultValue={80} starts the divider with most of the before photo showing, and the value text reads "20% after shown". ratio="16/9" gives a wide stage. Drag toward the end and the after tag fades once its side is too narrow for it.

default-80.astro

In a narrow column

In a 20rem sidebar with a square stage, the two buttons wrap under the caption. With no script the two photos stack, each with its tag.

narrow.astro
Minimal · Light

Waitlist

Be first in line

Join the waitlist and we'll email you the moment it's out.

You'll also get our newsletter: new themes, plugins and guides. Unsubscribe any time.