🎨 Framer Code Components Overrides

This skill helps you create Framer Code Components and Overrides, enabling advanced React customization, property controls, and robust hydration-safe patterns.

QUICK INSTALL
npx playbooks add skill fredm00n/framerlabs --skill framer-code-components-overrides

Framer Code Components Overrides instructions

Framer Code Development

Section tags: [C] applies to code components, [O] to code overrides, [C/O] to both.

Updates and contributions

This skill is maintained in the public repo [fredm00n/framerlabs](https://github.com/fredm00n/framerlabs/tree/main/skills/framer-code-components-overrides), and the community keeps it current. Installed copies go stale, so the steps below run once per session.

The project's line

The project's agent instructions (CLAUDE.md, AGENTS.md or equivalent) can hold one line for this skill:

framer-code-components-overrides: auto-update, contribute

auto-update lets the agent replace the installed copy when a newer version exists. contribute lets it offer to send what a session learns back to the repo as a pull request. Either word works alone. With no line, the agent never edits the installed files and never opens or suggests a pull request. It only says when a newer version is out.

Check for a newer version first

Before relying on anything below:

  1. Fetch https://raw.githubusercontent.com/fredm00n/framerlabs/main/skills/framer-code-components-overrides/SKILL.md and compare its metadata.version with the one in this file's frontmatter.
  2. Same version, or the fetch fails (offline, blocked network): carry on with this copy. If the fetch failed, say once that you couldn't check for updates.
  3. Remote is newer: use the remote SKILL.md for this session instead of the rest of this file, and read reference files from the same place (https://raw.githubusercontent.com/fredm00n/framerlabs/main/skills/framer-code-components-overrides/references/<file>.md) instead of the local copies. Then, by the project's line (NEW and OLD stand for the two version numbers):
  • No auto-update: leave the installed files alone and tell the user: "framer-code-components-overrides NEW is out and your copy is OLD, so I'm using the new version for this session. To update your copy, run npx skills add fredm00n/framerlabs --skill framer-code-components-overrides, or add framer-code-components-overrides: auto-update to your CLAUDE.md or AGENTS.md to stay current automatically. This skill is community-maintained: add contribute to that line (framer-code-components-overrides: auto-update, contribute) and I'll offer to send what we learn back as a pull request."
  • auto-update: download the whole skills/framer-code-components-overrides/ folder from the repo (a shallow git clone into a temp dir is simplest), then replace the installed folder with it in one go, so files removed upstream go too. If any download fails, leave the installed copy untouched. In a git repo, the update is an ordinary change: commit it on its own, in whatever branch or PR the current work goes to, never straight to a protected branch. Tell the user: "Updated framer-code-components-overrides from OLD to NEW, in its own commit." Without contribute on the line, add: "This skill is community-maintained: add contribute to its line in CLAUDE.md or AGENTS.md and I'll offer to send what we learn back as a pull request."

Only take updates from that exact repo and path.

Send what you learn upstream

Only when the project's line for this skill includes contribute.

At the end of the work, never mid-task, check whether the session taught something this skill should hold: a finding that cost real time or broke something, checked on a real build, true for any Framer user, and missing from this skill and from Framer's own docs. A fact about one project does not qualify. If nothing qualifies, say nothing.

If something does:

  1. Rewrite each finding for strangers. Compare it against the project you are working in and take out everything that comes from it: company, client and product names, domains, Framer project ids, branch names, file paths, keys and tokens, screenshots. Keep the date the finding was made, as "(2026-10-12)".
  2. Clone fredm00n/framerlabs, branch from main, and edit skills/framer-code-components-overrides/. Put each finding under the topic it belongs to, and edit an existing line rather than add a near-duplicate. Bump metadata.version (patch for a fix, minor for a new section) and add one plain-language line to the changelog in the root README.md, under today's date.
  3. Check the open pull requests for one that already covers the same finding. If there is one, add to it instead.
  4. Show the user the diff and ask before opening the pull request. A pull request on a public repo is public the moment it opens, even if it is never merged.
  5. With the user's yes, push the branch (to a fork without write access to the repo), open the pull request against main, and give the user the link. Write the commit message, title and description for the people who use these skills: what the change adds and when it helps, not which project or session it came from.

Maintainers: bump metadata.version on every change to this skill, reference files included, or installed copies will never see it.

Native First: Is Code Needed at All? [C/O]

Unless the user explicitly asks for a code component or a code override, build the feature natively
in Framer, with layers, variants, effects and CMS bindings. Write code only for what those cannot
express: WebGL, canvas, third-party SDKs, scroll maths, DOM and browser APIs.

This holds hardest for proven UI patterns. An FAQ accordion, tabs, a testimonial slider, a pricing
toggle, a nav dropdown and a modal are all native in Framer, and the native build is the better one:
the site owner edits it without code, binds it to the CMS, restyles it with text and colour styles,
and it adapts to breakpoints and survives Framer upgrades. A code component for one of these is
over-engineering even when it works and looks right.

A disclosure or accordion is one component with two variants, Collapsed and Expanded, and nothing
else. No wrapper component around the set: repeat the item with a Collection List so the content
comes from the CMS. No props, arrays of objects, or font, weight and colour controls that re-create
what native layers already do.

When you cannot tell whether native can do it, ask the user before writing code. Asking costs one
message; a wrong guess costs a whole build.

Pitfalls (quick lookup)

| Issue | Cause | Fix |
|-------|-------|-----|
| Variable text not found in override | Reading only props.children | Check props.text first — variable-bound text bypasses children |
| Font styles not applying | Accessing font props individually | Spread entire font object: ...props.font |
| Hydration mismatch | Browser API in render | Use isClient state pattern |
| Hydration error #425 at style, and SSR CSS with > selectors or quoted attribute values never applies | React 18's server renderer escapes <style>{css}</style> text, so > ships as &gt; and " as &quot; | Render <style dangerouslySetInnerHTML={{ __html: css }} /> |
| Dimensions stuck at 0 / SSR'd size persists | Initial state read from window already equals real value, setState no-ops | Init state to 0, flip in effect (see [Hydration Safety](#hydration-safety-co)) |
| Override finds no element after a later publish, with no error and no code change | It queried its own element by a React useId(); when hydration differs from the server render, the DOM keeps the server's id | Make the id in the browser after mount, or use a ref (see [Ids That Link Elements](#ids-that-link-elements-co)) |
| Child has no width, offsetLeft or offsetParent; scroll-snap-align on it is ignored | Framer wrapped each child of the frame in a display: contents element | Step to the first descendant with a box, measure with getBoundingClientRect (see [Measuring a Frame's Children](#measuring-a-frames-children-o)) |
| Color value crashes when user binds a token | ControlType.Color returns {value: "#xxx"} for tokens, string for static | Unwrap with tok(v) before use (see [Color Tokens](#color-tokens-controltypecolor-c)) |
| Override props undefined | Expecting property controls | Overrides don't support addPropertyControls |
| Override missing from Framer's picker dropdown | Export value is produced by calling a factory/HOC-generator — Framer's static scanner only recognizes literal override exports | Write each override as a literal export function withX(Component) or export const withX = (Component) => … (see [Overrides Must Be Literal Exports](#overrides-must-be-literal-exports-picker-detection-o)) |
| Scroll animation broken | overflow: scroll on container | Use IntersectionObserver on viewport (see [Scroll Detection](#scroll-detection-constraint-co)) |
| Scroll/animation silently stops working when target ID is set | useScroll target stored in useState captures null on first render | Use useRef for live-read targets (see [Live-Read Refs](#live-read-refs-useref-not-usestate-co)) |
| Named CMS layer not found by findByFramerName | Layer is a dynamic component instance — name not on data-framer-name | Wrap dynamic component in a plain frame carrying the expected name |
| Code component shows its empty state though a Collection List is in its slot | The slot prop is an array of one element; getCollectionData(array) finds no query | Pass props.collectionList[0] (see [references/cms.md](references/cms.md)) |
| CMS event lands on the wrong day for some visitors | A CMS date is the typed wall-clock time written as UTC, and local-time getters shift it | Read the day with getUTCDate() and friends (see [references/cms.md](references/cms.md)) |
| Every named layer of a CMS item missing at once | The whole repeated Collection List item was made a component | Keep the item a plain frame (see [The Repeated Item Is Never a Component](#the-repeated-item-is-never-a-component-c)) |
| Override that rewrites props.style height does nothing on the published page | Framer emits sizes as generated CSS classes, and the page root carries an inline min-height: 100vh | Set the value inline, with !important against the root (see [Published Sizing](#published-sizing-an-override-cannot-see-o)) |
| A page scaled or measured by code keeps the old breakpoint's size after a resize | Framer swapped the breakpoint layout in a render that landed after the resize had settled | Measure again after every render too (see [Measuring After a Breakpoint Swap](#measuring-after-a-breakpoint-swap-co)) |
| URL changes but the page does not load after router.navigate() or a scripted link click | Framer softens programmatic cross-page navigation into a desynced route change | Gate in place instead (see [Cross-Page Navigation](#no-programmatic-cross-page-navigation-co)) |
| HLS video permanently pixelated | .m3u8 in Chrome without HLS.js | Use HLS.js dynamic import pattern (see [HLS Video Streaming](#hls-video-streaming-m3u8-c)) |
| Overlay stuck "half-pressed" / needs two clicks to close | Triggering Framer interactions with synthetic events (dispatchEvent) | Call the React handler directly via fiber traversal (see [references/fiber-handlers.md](references/fiber-handlers.md)) |
| Overlay stuck under content | Stacking context from parent | Use React Portal to render at document.body level |
| Shader attach error | Null shader from compilation failure | Check createShader() return before attachShader() |
| TypeScript Timeout errors | Using NodeJS.Timeout type | Use number instead — browser environment |
| Component display name | Need custom name in Framer UI | Component.displayName = "Name" |
| Easing feels same for all curves | Not tracking initial distance | Track initialDiff when target changes (see [references/patterns.md](references/patterns.md)) |
| URL-bound filters don't react to a programmatic URL write | replaceState/pushState don't fire popstate | Dispatch it manually after writing (see [Writing State into the URL](#writing-state-into-the-url-c)) |
| Slider drag floods browser history / traps Back | pushState on every onChange | Use replaceState for high-frequency writes |
| Range input shows blue native fill / unstyleable thumb | Native <input type="range"> chrome | appearance:none + neutralise track + custom thumb per engine (see [Styling Native Range Inputs](#styling-native-range-inputs-c)) |
| Override-wired button ignores Enter and Space | onTap is a pointer gesture; keyboard and .click() never fire it | Pass onClick to the instance (see [Component Instances](#component-instances-onclick-variant-scoped-css-o)) |
| DOM added by an override vanishes, or React throws insertBefore / removeChild errors | The override replaced or edited children React owns | Insert siblings next to React's nodes, never replace them (see [Inserting DOM Next to React's Nodes](#inserting-dom-next-to-reacts-nodes-o)) |
| Hidden form value arrives empty | Value written after Framer read the form, or the input was injected by code | Native hidden input, filled in a capture-phase submit listener (see [Framer Forms](#framer-forms-o)) |
| New CMS item only shows after a reload | CMS content is baked into each published deployment | Re-fetch the page and insert the new cards (see [Refreshing Published CMS Content](#refreshing-published-cms-content-in-place-o)) |
| "Private" CMS field readable by anyone | Framer publishes every field of every item in .framercms files | Keep private data out of the CMS (see [CMS Data Is Public](#cms-data-is-public-co)) |

Contents

  • [Native First](#native-first-is-code-needed-at-all-co) — whether the feature needs code at all
  • [Foundations](#foundations) — components vs overrides, annotations, starter templates, multi-file components
  • [Authoring](#authoring) — property controls, fonts, color tokens
  • [Rendering & SSR](#rendering--ssr) — hydration, canvas detection, concurrent rendering, npm imports
  • [CMS](#cms) — text timing in overrides, the repeated item, code-component CMS pattern, what the CMS makes public
  • [Overrides — specific patterns](#overrides--specific-patterns) — variant control, fiber handlers, component instances, Framer forms
  • [DOM & Performance](#dom--performance) — scroll detection, live-read refs, portals, published sizing, measuring after a breakpoint swap, cross-page navigation, inserting next to React, live CMS refresh, common patterns
  • [Media](#media) — HLS video, WebGL
  • [Debug](#debug) — gated logging

---

Foundations

Code Components vs Overrides

Code Components [C]: Custom React components added to canvas. Support addPropertyControls.

Code Overrides [O]: Higher-order components wrapping existing canvas elements. Do NOT support addPropertyControls.

Required Annotations [C/O]

Always include at minimum:

/**
 * @framerDisableUnlink
 * @framerIntrinsicWidth 100
 * @framerIntrinsicHeight 100
 */

Full set:

  • @framerDisableUnlink — Prevents unlinking when modified
  • @framerIntrinsicWidth / @framerIntrinsicHeight — Default dimensions
  • @framerSupportedLayoutWidth / @framerSupportedLayoutHeight — any, auto, fixed, any-prefer-fixed

Most Framer code files can start with // @ts-nocheck. Framer's hook and prop types are loose, and some
patterns (conditional hooks, fiber walking) fail strict TypeScript.

Code Override Pattern [O]

import type { ComponentType } from "react"
import { useState, useEffect } from "react"

/**
 * @framerDisableUnlink
 */
export function withFeatureName(Component): ComponentType {
    return (props) => {
        // State and logic here
        return <Component {...props} />
    }
}

Naming: Always use withFeatureName prefix.

Overrides take no property controls and cannot query the CMS; they read CMS content only once it is
rendered (see [CMS](#cms)). Their settings live in a constants block at the top of the file.

Overrides Must Be Literal Exports (picker detection) [O]

Framer's override picker statically scans the file and only lists exports it can syntactically recognize as an override — a literal function declaration or an arrow assigned directly to the export. An export whose value is the return of a function call is invisible to the scanner: it won't appear in the Override dropdown (even though it would work if referenced by name).

This bites hardest when you try to DRY up several near-identical overrides with a factory:

// ❌ BROKEN — factory hides the overrides from the picker.
// Only literal functions in the file get listed; these three never appear.
const setVariant = (name) => (Component) => (props) => {
    const [, setStore] = useStore()
    return <Component {...props} onClick={() => setStore({ variant: name })} />
}
export const withSetVariant1 = setVariant("Variant 1") // not listed
export const withSetVariant2 = setVariant("Variant 2") // not listed
export const withSetVariant3 = setVariant("Variant 3") // not listed

// ✅ CORRECT — each override is a literal function; all are listed.
export function withSetVariant1(Component): ComponentType {
    return (props) => {
        const [, setStore] = useStore()
        return <Component {...props} onClick={() => setStore({ variant: "Variant 1" })} />
    }
}

Both literal forms are recognized: export function withX(Component) {…} or export const withX = (Component) => (props) => …. The rule: never produce an override by calling a helper — repeat the literal per override, even if it's more verbose. (Full worked example — 3 setters + 1 reader sharing a store — in [references/patterns.md](references/patterns.md) → Shared State Between Overrides.)

Code Component Pattern [C]

import { motion } from "framer-motion"
import { addPropertyControls, ControlType } from "framer"

/**
 * @framerDisableUnlink
 * @framerIntrinsicWidth 300
 * @framerIntrinsicHeight 200
 */
export default function MyComponent(props) {
    const { style } = props
    return <motion.div style={{ ...style }}>{/* content */}</motion.div>
}

MyComponent.defaultProps = {
    // Always define defaults
}

addPropertyControls(MyComponent, {
    // Controls here
})

Multi-File Components [C]

A component split across several source files needs one Framer code file per source file, and every
import between them carries its extension: ./constants.tsx, not ./constants.

---

Authoring

Property Controls Reference [C]

See [references/property-controls.md](references/property-controls.md) for complete control types and patterns.

Font Handling [C/O]

Never access font properties individually. Always spread the entire font object.

// ❌ BROKEN - Will not work
style={{
    fontFamily: props.font.fontFamily,
    fontSize: props.font.fontSize,
}}

// ✅ CORRECT - Spread entire object
style={{
    ...props.font,
}}

Font control definition:

font: {
    type: ControlType.Font,
    controls: "extended",
    defaultValue: {
        fontFamily: "Inter",
        fontWeight: 500,
        fontSize: 16,
        lineHeight: "1.5em",
    },
}

Color Tokens (ControlType.Color) [C]

A ControlType.Color value arrives as a plain string when the user picks a static color, but as a { value: "#xxx" } object when bound to a Framer color token. Components that read the value directly break the moment the user binds a token.

Always unwrap:

const tok = (v: any) =>
    v && typeof v === "object" && "value" in v ? v.value : v

const bg = tok(props.background) // string in both cases

Use tok() wherever a color prop is consumed for parsing, CSS strings, or canvas styles. Same wrapper shape may appear on other token-bindable controls (sizes, shadows) — check before assuming.

---

Rendering & SSR

Hydration Safety [C/O]

Framer pre-renders on server. Browser APIs unavailable during SSR.

Two-phase rendering pattern:

const [isClient, setIsClient] = useState(false

Related Skills

Get the best new skills
in your inbox

Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.