Framer, for real: code, components and project¶
Exercise framer-code-components-project-annex.pdf · PDF Project brief framer-project-brief.pdf · PDF
Open your published Framer page and press F12. Go to Elements and unfold three levels. Class names made of letters and numbers, div inside div inside div, styles nobody would type. Framer wrote this for you. If you had to change it by hand tomorrow, could you?
Your page is online, but so far it is one person's drawing. Three cards you built by hand, a button that goes nowhere, and code you have never read. This page turns it into a real web page, and gets you started on the project that assesses Unit 2. There is no Unit 2 exam: the project is the assessment.
What you will learn
- Open the code of a page Framer published, and say what is good and what a person could not maintain
- Turn a repeated piece into a component, use its instances, and change their content without breaking the link
- Add a variant and a hover state to a component
- Link buttons to a section or a page, and give every content image an alternative text
- Start the Unit 2 project knowing exactly what is graded
- The trap: why generated code is not the same as bad code
What the press printed¶
We are back at the printing press. The poster on the street is perfect. The plates the press used to print it were made for the machine, not for you.
Reading those plates is a skill you can practise on your own page, and the eight problems give you the words. Here is where to look:
| Find... | Where to look |
|---|---|
The tag of your main title. Is it an h1? |
Right-click the title, then Inspect |
| Two class names of the hero. Could a person guess what they style? | The class attribute |
| Your stack, in CSS. Which lines make it a stack? | The Styles panel of the hero |
| What a Fill card became in CSS | The Styles of one card |
| The width of the Phone breakpoint, in code | Search the styles for @media |
Is the button a button, an a or a div? |
Inspect it |
An @media rule, or media query, is CSS that applies only at certain window widths. It is what a breakpoint turns into in the browser.
The details change with Framer's versions, so trust what your page shows. The overall verdict does not change much:
| Framer avoids | Framer keeps (for a person) |
|---|---|
| Frozen size and absolute positions: stacks become flexbox, breakpoints become media queries | Names nobody can read: the classes are generated |
| Missing head lines: it adds the viewport and the page title for you | Nesting nobody would write by hand |
| No files to take away: you can read the code, never edit it |
Careful: generated code is not bad code
Framer's page is fast and responsive. It is unmaintainable by a person, which is a different defect. "Good for the browser" and "readable for a person" are two separate qualities. The defect only matters if a person must maintain the code, and in Framer nobody does: you edit the canvas.
Components: one master plate¶
You built three cards by hand. Now change the corner radius of all of them. Three edits. On a page with twelve cards, twelve edits and one forgotten. You solved this in Figma with the mould and its bricks, and in the print shop it is the same trick: one master plate, many prints.
| Word | Meaning |
|---|---|
| Component | The master piece. Change it once, and every copy follows |
| Instance | A copy of the component, placed on the page |
| Property | A part of the component you let each instance change (a text, an image, a colour), without touching the rest |
Framer calls these properties variables in some panels. Do not confuse them with Figma's variables: here it only means "this part can change per instance".
To make one:
- Right-click a feature card and choose Create Component. Name it
Card. - Delete the other two cards, and drag in two instances of
Cardfrom the Assets panel. - Change the title of one instance: only that one changes.
- Change the corner radius inside the component: all three change.
Then let each instance have its own content: make the title and the body text properties. Do the same with your button. Check that the three cards still Fill the row on Desktop and stack on Phone.
flowchart TB
C["<b>Component: Card</b><br>the master plate<br>radius, padding, structure"]
C -->|"title and body = properties"| I1["<b>Instance</b><br>its own title and body"]
C -->|"title and body = properties"| I2["<b>Instance</b><br>its own title and body"]
C -->|"title and body = properties"| I3["<b>Instance</b><br>its own title and body"]
The unlink trap
Editing an instance and expecting the others to follow? Edit the master instead: double-click into the component. Worse is cutting an instance loose just to change a text. Framer calls this unlinking (Figma calls it detach). It is faster today, but the next change to the master will not reach that copy. Undo it, and expose the text as a property.
A component is not a group, either. A group only holds layers. A component has instances that follow it.
Variants and hover¶
A button is not one picture. It has versions, and it reacts.
A variant is another version of a component, inherited from its primary variant. A hover state is the version shown while the mouse is over it.
Open your Button component and add a hover state. Framer branches it from the primary variant and wires the interaction for you. Change the background in the hover state, then open Preview and move the mouse over the button: it animates between the two. Then add a second variant, Secondary, with just an outline, and use it for one button.
Now give your Card a hover state too, for example a darker border.
Will your hover work on a phone?
There is no mouse on a phone. Hover is feedback: "this can be clicked". On a touch screen it does not exist, so it can never be the only clue. Hover adds information; it never hides it. The page must make sense without it.
Make it work for everybody¶
These five checks come straight from Unit 1, and they are quick:
| # | Do | Why |
|---|---|---|
| 1 | Every button has a link: to a section of the page, or to another page | A button that does nothing breaks a promise to the visitor |
| 2 | Every image that carries content has an alternative text; decorative ones have none | WCAG 1.1.1, text alternatives |
| 3 | The page has a title and a description in its settings | It is what the browser tab and a search engine show |
| 4 | Text on the brand colour passes 4.5:1 | WCAG 1.4.3, contrast |
| 5 | Press Tab on the published page: every link is reached, in order | WCAG 2.1.1, keyboard |
The project: fix the school bar¶
The project starts at the school bar: go and look, and note its problems (queues at the break, not knowing what is left, prices, paying...) and ideas to solve them. It joins that visit to your Framer work.
The brief, in one breath
Build and publish, with Framer, the web page of your solution to one problem of the school bar: what the problem is, how your solution works, and why a student would use it. It is individual. Two students may pick the same problem, but never the same page. Marked out of 10.
Due Friday 6 November 2026, 23:59, in the Classroom task UT2 · The school bar project.
The project brief has the full list and the rubric. In short, your page needs:
| # | Requirement |
|---|---|
| 1 | Four sections or more, in order: a hero, the problem (with a real fact from your visit: a queue time, a count, a quote), three or more feature cards, and a footer |
| 2 | Stacks everywhere. Nothing floats in absolute position unless it decorates |
| 3 | Sizing modes chosen on purpose: cards Fill, buttons Fit Content, content within a max width you choose |
| 4 | Three breakpoints. On Phone, at least one row becomes a column |
| 5 | Two components or more, with properties, used as instances. One of them is a button with two variants and a hover state |
| 6 | It works for everybody: the five checks above |
| 7 | Code reading: a file code-reading.txt with five findings from DevTools on your published page. Each says what you inspected, what Framer generated (copy the line), and whether a person could read and maintain it, and why |
You hand in the address of the published page, an invitation to the teacher's account as editor of the project, three screenshots (Desktop, Tablet and Phone) and the file code-reading.txt.
The rules that can cost you everything
No template. The Insert menu is allowed, adapted to your page. Starting from a Framer template scores 0. No AI that generates the page, its layout or its text, so Framer's AI tools stay off. That also scores 0, and so does copying. You may use this site, MDN, Framer's help, and cs50.ai for questions. A late hand-in gets at most 5, and more than 48 hours late gets 0.
How to start¶
Do not open the colour picker yet. Write one sentence with the problem and your solution, in this shape: "At the break the queue takes 10 minutes, so my app lets you order before the bell." Your own fact from the bar goes in it.
Then write the content: the sections in order, with the real text. What does a visitor read first, second, third? Only then do you draw. And do not build ten sections: the brief asks for four or more, and a short page done well beats a long one copied.
Key takeaways¶
- Framer's code is good for the browser but unmaintainable by a person: those are two separate qualities. In Framer you edit the canvas, not the code.
- A component is the master piece, an instance is a copy that follows it, and a property is what each instance may change.
- Unlinking an instance cuts it off from future changes to the master. Expose a property instead.
- A variant is another version of a component. A hover state adds feedback, but it cannot be the only clue, because touch screens have no hover.
- Every button links somewhere, content images have alternative text, and Tab reaches every link in order.
- The Unit 2 project is the assessment: a Framer page for your solution to a school bar problem, due Friday 6 November 2026, 23:59.
Quick check¶
1. Your published Framer page is fast and works at every width, but its class names are unreadable. What is the fairest verdict?
- Good for the browser, and hard for a person to maintain
- Bad for the browser, and easy for a person to maintain
- Good for the browser, and easy for a person to maintain
- Bad for the browser, and hard for a person to maintain
These are two separate qualities. Generated code can serve the browser very well and still be unmaintainable by hand. That defect only matters if a person must maintain it, and in Framer you edit the canvas.
2. Where do you look in the browser to see how a breakpoint was written in CSS?
- In the
@mediarules of the page's styles - In the
altattributes of the page's images - In the
hrefattributes of the page's links - In the
titleelement of the page's head
A breakpoint turns into a media query: CSS that applies only at certain window widths. You find it by searching the styles for @media in DevTools.
3. You change the corner radius inside a Card component that has three instances. What happens?
- All three instances change, because they follow the component
- Only the first instance changes, because it was placed first
- None of the instances change, until each one is reset by hand
- All three instances are removed, and must be placed once more
An instance is a copy that follows its component: change the master once, and every copy follows. That is the whole point of having one master plate.
4. Each of your three cards needs a different title. What is the right way to do that?
- Make the title a property, and set it on each instance
- Unlink each instance, and type each title on the copy
- Group the three cards, and type each title on the group
- Make three components, and place one instance of each
A property lets each instance change that one part and stay linked. Unlinking would cut the copies off from every later change to the master, and three separate components would mean three edits forever.
5. Why can a hover state not be the only sign that a card can be clicked?
- Touch screens have no mouse, so people on phones never see it
- Framer removes all hover states from a page when you publish it
- Browsers only show a hover state on the first visit to a page
- Screen readers read a hover state aloud as if it were a warning
Hover is feedback for a mouse, and on a touch screen it does not exist. Hover adds information; it never hides it, so the page must make sense without it.
6. You are building a page for a local library, and one image is purely a decorative wave behind the title. What should its alternative text be?
- None, because it carries no content
- The file name, so a reader can find it
- The word image, so a reader can skip it
- A long description of its colours and shape
Alternative text is for images that carry content. A decorative image gets none, so a screen reader skips it instead of wasting the listener's time (WCAG 1.1.1).
7. Which of these would be against the rules of the Unit 2 project?
- Starting your page from a Framer template
- Inserting a footer from Insert and adapting it
- Asking cs50.ai a question about the sizing modes
- Reading Framer's help about hover states
Templates score 0, and so does AI that generates the page, its layout or its text. The Insert menu is allowed if you adapt what you insert, and cs50.ai, MDN and Framer's help are allowed for questions.
8. You are about to start your project. What should you do first?
- Write the problem and solution in one sentence, then the content
- Pick the colours and the fonts, then the problem and the solution
- Build the three breakpoints, then the problem and the solution
- Publish a blank page, then the problem and the solution
Content comes first: what does a visitor read first, second, third? Colours and fonts only make sense once you know what they are decorating.
You have read what a machine prints. From Unit 3 you leave the editors and write the app yourself: everything you saw in DevTools, you will now write on purpose. Next: Unit 3.