Before-After Slider for Framer - Step by Step

Framer does not have a native before-after slider component. You can add one in about two minutes with Custom Code and an Embed component. No React code needed.
The slider above is a live demo. Here is how to get that on your Framer site.
What you need
- A Framer site on a Basic plan or higher - the free plan does not support Custom Code in Site Settings
- Two images you want to compare
The before-after slider is free. No OneType account or sign-up needed.
Step 1: Add the script tag
- In the Framer editor, click the gear icon (Settings) in the top-right corner
- Go to the General tab
- Scroll to the Custom Code section at the bottom
- Click Show Advanced to see all placement options
- In the End of tag field, paste:
<script src="https://cdn.transforms.onetype.ai/script/57095981335841558d328d599e6f5322.js"></script>
- Click Save
The script now loads on every page of your site.
Step 2: Add the slider with an Embed component
- Open the page where you want the slider
- Open the Insert menu (or press /)
- Search for Embed
- Drag the Embed component onto the canvas
- In the component settings, switch to the HTML tab
- Paste this:
<div ot="before-after">
<img src="YOUR_BEFORE_IMAGE_URL" alt="Before">
<img src="YOUR_AFTER_IMAGE_URL" alt="After">
</div>
- Replace the image URLs with your actual images
- Resize the Embed component on the canvas to fit your layout
Step 3: Publish
The slider will not render in the Framer editor - that is normal. Publish your site or use the Preview URL to see the slider live and interactive.
Customization
Add these attributes to the div to change the slider:
- ot-direction="vertical" - slide top to bottom
- ot-label-before="Original" and ot-label-after="Edited" - text labels
- ot-position="30" - start at 30% instead of center
- ot-hover="true" - slider follows the mouse
Why not a Code Component?
You could build this as a Framer Code Component with React, but it is unnecessary. The Embed approach is simpler - paste the HTML and you are done. No React, no TypeScript, no property controls to set up.
If you plan to reuse the same slider on many pages, a Code Component with property controls might save time. But for one or two sliders, the Embed is the way to go.
Get started
The before-after slider is free at transforms.onetype.ai. For all customization options and use cases, check the main before-after slider guide.