Framer is a powerful prototyping tool that lets developers build interactive UI with real React code. In this tutorial we walk through installing Framer, creating a first project, adding code components, and exporting clean JSX. Follow each step and you’ll have a working prototype in under an hour.
Framer runs as a desktop app on macOS, Windows, and Linux. You can also use the web version, but the desktop client gives better performance.
# macOS (brew)
brew install --cask framer
# Windows (PowerShell)
winget install Framer.Framer
After installation, launch Framer and sign in with your GitHub or Google account.
When you open Framer, you see the welcome screen. Click New Project and choose Blank Canvas.
Rename the project to dev‑prototype by clicking the title at the top left.
Framer lets you write React components directly in the editor. We’ll create a simple button that toggles a modal.
ToggleButton.import * as React from "react";
import { motion } from "framer-motion";
export function ToggleButton({ onClick, isOpen }) {
return (
<motion.button
onClick={onClick}
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
style={{
padding: "12px 24px",
background: isOpen ? "#0066cc" : "#e0e0e0",
color: isOpen ? "#fff" : "#000",
border: "none",
borderRadius: 4,
cursor: "pointer"
}}
>
{isOpen ? "Close" : "Open"} Modal
</motion.button>
);
}
Save the component. Framer instantly renders a live preview on the canvas.
Drag the new ToggleButton from the left panel onto the canvas. Then create a Modal component using the same method and link them with a simple state.
import * as React from "react";
import { ToggleButton } from "./ToggleButton";
import { motion, AnimatePresence } from "framer-motion";
export function Demo() {
const [open, setOpen] = React.useState(false);
return (
<>
<ToggleButton onClick={() => setOpen(!open)} isOpen={open} />
<AnimatePresence>
{open && (
<motion.div
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -20 }}
style={{
position: "fixed",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
background: "#fff",
padding: "24px",
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
borderRadius: 8
}}
>
<h3>Hello from Framer!</h3>
<p>This modal is built with real React code.</p>
</motion.div>
)}
</AnimatePresence>
</>
);
}
Framer’s motion library is built into the environment. You can add scroll‑based or gesture‑based animations without extra dependencies.
import { useViewportScroll, motion } from "framer-motion";
export function FadeOnScroll() {
const { scrollYProgress } = useViewportScroll();
return (
<motion.div
style={{
opacity: scrollYProgress,
height: "200vh",
background: "linear-gradient(#fff, #0066cc)"
}}
>
<h2 style={{marginTop:"150vh", textAlign:"center"}}>Scroll fades in</h2>
</motion.div>
);
}
Drop FadeOnScroll onto the canvas and preview in the browser. The background fades as you scroll.
When your prototype works, you can copy the clean JSX and paste it into any React project.
The copied code includes all imports and props, ready for create‑react‑app or Next.js.
In a Next.js page pages/index.js:
import { Demo } from "../components/Demo";
export default function Home() {
return (
<main style={{padding:"2rem"}}>
<Demo />
</main>
);
}
Run npm run dev and you’ll see the same interactive prototype you built in Framer.
Developers often compare Framer with Figma, Adobe XD, and Webflow. The table below focuses on features that matter to code‑centric teams.
| Feature | Framer | Figma | Webflow |
|---|---|---|---|
| Live React code | ✅ Full JSX editing | ❌ No code editing | ✅ Export clean HTML/CSS, limited JS |
| Animation library | ✅ Framer Motion built‑in | ❌ Plugins only | ✅ Interactions UI |
| Team collaboration | ✅ Real‑time, comment | ✅ Real‑time, comment | ✅ Real‑time, comment |
| Free tier limits | Unlimited prototypes, limited premium components | Unlimited frames, limited version history | 2 projects, limited CMS items |
| Export formats | JSX, CSS, PNG, GIF | SVG, PNG, PDF | HTML, CSS, JS |
If you need real React code, Framer wins. For pure UI design, Figma is lighter. Webflow shines when you want a no‑code site that ships as static HTML.
No. Framer provides code components and a visual canvas, so developers can start without design skills.
Yes. Framer lets you copy the generated JSX for any component and paste it into a React project.
Framer offers a free tier that includes unlimited prototypes, but limits premium components and team features.
Figma focuses on UI design, while Framer adds interactive code components. For developers who need real‑world behavior, Framer is usually faster.
Framer preview works in Chrome, Edge, Safari, and Firefox on desktop and mobile.
Now you have a complete workflow: install, build, animate, and export. Use these steps to turn ideas into production‑ready React components faster than ever.