Design+Code logo

Quick links

Suggested search

Code Overrides

Code overrides offer a powerful method to augment existing framework elements with additional functionality through code, without the need to build components from scratch. Here's how to effectively use code overrides in your projects:

Image 85

Understanding Code Overrides: They allow you to inject custom behavior or styling into existing elements of your framework. This is particularly useful for adding interactivity or dynamic effects with minimal effort.

Applying Code Overrides:

  • Select the group or element you wish to modify, such as a hexagon shape within your project.
  • In the Inspector, look for the "Code Overrides" section and click on the plus sign to add a new override.
  • Choose the default file provided or a specific one you have prepared for overrides.

Types of Effects in Code Overrides:

  • Hover: Enhances user interaction by adding hover effects. This effect is visible only in preview mode.
  • Random Color: Introduces dynamic color changes on interaction, making each preview playthrough unique.
  • Rotate: Applies rotation to elements, adding a dynamic visual effect.

Exploring the Code:

  • Find the override code in the examples.tsx file within the assets or code section of your project.
  • The file contains examples like withRotate, showcasing how to apply animations and transitions, including hover states and scaling.
  • Random Color demonstrates using a store to animate and remember states across the application lifecycle, a technique useful for more complex functionalities.

Customizing Overrides:

  • Adjustments such as changing scale values (e.g., to 1.1) can be made directly in the code to fine-tune the effect according to your design needs.
  • Explore the documentation for more in-depth guidance on setting up and customizing code overrides.
  • Let's set back to withHover.

Code Override with CSS

import styled from "styled-components"
import type { ComponentType } from "react"

export function withBorderGradient(Component): ComponentType {
    const StyledComponent = styled(Component)`
        background: red;
    `

    return (props) => {
        return <StyledComponent {...props} />
    }
}

Border Gradient

import styled from "styled-components"
import type { ComponentType } from "react"

export function withBorderGradient(Component): ComponentType {
    const StyledComponent = styled(Component)`
        &::before {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 8px;
            padding: 1px;
            -webkit-mask: linear-gradient(#fff 0 0) content-box,
                linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            background: linear-gradient(10deg, rgba(255, 255, 255, 0.00) 33.33%, #FFF 95%), rgba(255, 255, 255, 0.10);

            @media (prefers-color-scheme: dark) {
                background: linear-gradient(253deg, rgba(60, 60, 120, 0.1) 0%, rgba(60, 60, 120, 0.00) 100%);
            }
        }
    `

    return (props) => {
        return <StyledComponent {...props} />
    }
}

Hexagons Component

Image 86

To efficiently integrate the Hexagon Button component with a dynamic logo system across a hexagon pattern, follow this streamlined process:

Selecting the Hexagon Group:

  • Exit the individual Hexagon Button component editing mode.
  • Select the entire folder or group containing all hexagon shapes to create a cohesive component set.

Creating a Master Component:

  • Convert the selected group of hexagons into a single, unified component called Hexagons. This master component represents your hexagon pattern, enabling centralized control over the entire layout.

Duplicating and Replacing Hexagons:

  • Copy the Hexagon Button component to replace each static hexagon within the pattern.
  • Ensure correct selection of the group for seamless replacement. This step is crucial for maintaining alignment and spacing consistency.

Customizing Logos:

  • For each hexagon, use the Command-Shift-V shortcut (or its equivalent in your design tool) to paste and replace the static hexagon with the HexagonButton component.
  • Adjust the logo variable for each component to match the intended company logo (e.g., Visa, Square, X, Google, Apple, Vercel).
  • For hexagons meant to remain without a specific logo, set the logo variable to None.

Component Variants

To create a dynamic and engaging interaction design with your Hexagon Button components, involving unique animations and patterns upon hover, follow these steps:

Variant Creation

  • Default Variant: The starting layout of your hexagon pattern.
  • Custom Variants: Create at least two additional variants focused on the X logo and Visa logo, each with a unique animation or layout shift upon hover. Include a fourth variant with a distinctly different pattern, such as a circle.

Image 87

Design Unique Patterns

  • For each custom variant, rearrange the hexagons to highlight the logo being hovered over. This could mean moving the related hexagon to a central position or creating a visual flow that directs the user's attention to the logo.
  • Beyond Boundaries: Don't limit your design to the original boundaries. Feel free to extend hexagons outside their initial layout, ensuring they remain part of the variant group.
  • Focus on Visibility: Ensure that no hexagon, especially those with logos, is hidden or obscured in any variant. This maintains clarity and engagement.

Rearrange Non-active Logos

  • For logos not in focus for a particular variant, consider rearranging or slightly adjusting their position to complement the highlighted logo. This creates a cohesive and dynamic visual effect.

Creative Pattern Design

  • For the fourth variant, experiment with a circle pattern or any other shape that contrasts with the default hexagonal arrangement. This variant should offer a visually striking alternative to the standard layout.
  • Creativity Encouraged: You're not limited to replicating predefined patterns. Explore unique layouts that reflect the brand or theme you're working with.

Hover Variant Transitions

To set up transitions for the Hexagons component that animate between variants on hover, follow these structured steps:

Image 88

Initiate Hover Transition

  • Select Variant 1: Start with the first variant of your HexagonButton component where the default state is set.
  • Hover on X Button: Focus on the X logo within Variant 1.

Setting Transitions

  • Mouse Enter for X: Click on the interaction icon next to the X button to create a transition to Variant 2. This transition should occur on mouse enter, indicating the hover state activation.
  • Visa Logo Transitions: Similarly, for the Visa logo in Variant 1, set a transition to Variant 3 on mouse enter. Then, from Variant 3, ensure there’s a transition back to Variant 1, focusing on the Visa button.

Adjust Transition Speed and Easing

  • For each transition, apply a slower transition speed to enhance the visual effect. An easing out duration of 1 second is recommended to create a smooth, gradual animation that catches the user's attention.
  • Make sure to set the same Transition for the Hexagon Button component.

Scroll Variants

Let's streamline the process for applying scroll variance to the Hexagons component. Follow these steps for a clear and efficient update:

Image 89

  • Exit the Hexagons Component: Make sure you're not currently editing the Hexagons component. This ensures you can apply global effects properly.
  • Apply Scroll Variant: Choose the Scroll Variant option and set it to "Layer in View". This will activate the variant effect as the component enters the viewport.
  • Adjust Variants: Change the variant setting from Variant 1 to Variant 4. This step customizes the animation or effect triggered during the scroll.
  • Set Padding: To create space around the component and enhance visibility during scrolling, add: a Padding Top and Bottom of 500px for significant space above the component.

Conclusion

Wrapping up, we've covered how to spice up your Framer projects with code overrides and property controls. These features let you tweak and animate your designs directly from the UI, no heavy coding needed. You've seen how to make elements interactive with just a few clicks, adding cool effects like hover, spin, and color shifts.

Think of these tools as your design superpowers. They're here to help you make your projects pop, with minimal fuss and maximum creativity. Dive in, play around, and see what awesome designs you can come up with. The more you experiment, the more you'll discover. Happy designing!

BACK TO

Property Controls in Framer

READ NEXT

CMS Collection Page and Detail

Templates and source code

Download source files

Download the videos and assets to refer and learn offline without interuption.

check

Design template

check

Source code for all sections

check

Video files, ePub and subtitles

Assets

Videos

1

Complete Beginner-Friendly Framer Course

4-hour free course to create beautiful, modern interfaces. Dark mode and glass designs, from Figma to Framer, using stack and grid layouts

7:09

2

Create Your First Layout in Framer

Master the basics of layout creation in Framer with this comprehensive step-by-step guide for beginners. Start building your designs today!

13:47

3

Generate Layout with AI in Framer

Create stunning websites with ease using Framer's AI-powered layout generator

7:26

4

Basic Layout and Interactive Elements

Learn how to create a user-friendly layout with interactive elements to enhance the user experience and engagement on your website or app

15:28

5

Text and Vector Animations

Transform your content with captivating text and vector animations

18:14

6

UI Design from Figma to Framer

Mastering the art of transitioning your UI design projects seamlessly from Figma to Framer with expert tips and techniques

13:16

7

Adaptive Layout with Stacks and Constraints in Framer

Create responsive designs easily using stacks and constraints in Framer. Perfect for adaptive layouts for web and mobile projects

12:03

8

Responsive Layout with Breakpoints and Min Max

Create a user-friendly website with responsive design, incorporating breakpoints and min-max values to ensure optimal display on all devices

13:55

9

Button Components, Variables and Variants

Explore different button components, variables, and variants to enhance the functionality and aesthetics of your projects

11:01

10

Appear, Hover, Press, Loop and Drag Effects

Mastering Framer Effects: Create interactive sites with Appear, Hover, Press, Loop, Drag Effects

11:17

11

Scroll Speed and Transform in Framer

Learn how to create dynamic Framer sites with advanced features for interactive designs

15:15

12

Scroll Variants and Stick Element

Enhance User Navigation with Sticky Elements and Scroll Variants in Framer

12:13

13

Copy Components, Custom Cursors and 3D Embeds

Learn how to incorporate Framer's interactive elements into your designs

10:00

14

Grid and Bento Layout

Enhancing Your Designs with Grid and Bento Layouts in Framer

11:26

15

Icon Animation, Menu and Overlay

Web Design User Experience with Icon Animation, Menus, and Overlays in Framer

11:00

16

Code Components with Basic CSS

Create Basic Code Components with CSS in Framer

12:11

17

Property Controls in Framer

Mastering Property Controls for Interactive Framer Components

9:23

18

Code Overrides in Framer

Enhancing Your Framer Elements with Code Overrides

13:23

19

CMS Collection Page and Detail

Integrating Figma Designs with Framer and CMS

14:22

20

Search and Navigation

Enhancing User Experience: Search, Navigation, and Footer Integration

14:25

Meet the instructor

We all try to be consistent with our way of teaching step-by-step, providing source files and prioritizing design in our courses.

Meng To

I design, code and write

Meng To is the author of Design+Code. Meng started off his career as a self-taught designer from Montreal and eventually traveled around the world for 2 years as his US VISA was denied. During his travels, he wrote a book which now has 35,000 readers.

icon

39 courses - 183 hours

course logo

Build SwiftUI apps for iOS 18 with Cursor and Xcode

In this course, we'll explore the exciting new features of SwiftUI 6 and Xcode 16 for building iOS 18 apps. From mesh gradients and text animations to ripple effects, you'll learn how to create polished, highly custom apps using the latest workflows. We'll also dive into using Cursor and Claude AI for AI-driven coding, helping you start strong and customize your apps.

5 hrs

course logo

Create your Dream Apps with Cursor and Claude AI

Learn to build your dream web apps from the ground up using Cursor, Claude AI, and a suite of powerful AI tools. This course covers everything you need, including React for frontend development, Firebase for backend integration, and Stripe for handling payments. You’ll also dive into advanced AI tools like Claude Artifacts, Galileo AI, v0.dev for UI, Ideogram for design generation, and Cursor Composer for full-scale development.

5 hrs

course logo

Build a React Site from Figma to Codux

In this course, you'll learn to build a website from scratch using Codux, starting with a Figma template. You’ll master responsive design, collaborate with developers on a real React project, export CSS from Figma using Locofy, set up breakpoints with media queries, add CSS animations, improve SEO, create multiple pages with React Router, and publish your site. By following best practices, you’ll bridge design and development, improve your web design skills.

2 hrs

course logo

Create 3D UI for iOS and visionOS in Spline

Comprehensive 3D Design Course: From Basics to Advanced Techniques for iOS and visionOS using SwiftUI

3 hrs

course logo

Master No-Code Web Design with Framer

In this free Framer course, you'll learn to create modern, user-friendly interfaces. Start with dark mode and glass designs, then move from Figma to Framer, using vectors and auto layout for responsive websites. Add animations, interactive buttons, and custom components with code. Finally, you'll craft a design system suitable for teamwork or solo projects, all in a straightforward and practical approach.

4 hrs

course logo

Build SwiftUI Apps for iOS 17

In this course, we’ll be exploring the fresh and exciting features of SwiftUI 5! As we craft a variety of iOS apps from the ground up, we'll delve deep into the treasure trove that is SwiftUI's user interface, interactions, and animations.

4 hrs

course logo

Build Beautiful Apps with GPT-4 and Midjourney

Design and develop apps using GPT-4 and Midjourney with prompts for SwiftUI, React, CSS, app concepts, icons, and copywriting

4 hrs

course logo

Build SwiftUI apps for iOS 16

Create animated and interactive apps using new iOS 16 techniques using SwiftUI 4 and Xcode 14

5 hrs

course logo

Build a 3D Site Without Code with Framer

Design and publish a responsive site with 3D animation without writing a single line of code

3 hrs

course logo

Create 3D Site with Spline and React

Design and code a landing page with an interactive 3D asset using Spline and CodeSandbox

1 hrs

course logo

Build an Animated App with Rive and SwiftUI

Design and code an iOS app with Rive animated assets, icon animations, custom layouts and interactions

3 hrs

course logo

Build a SwiftUI app for iOS 15 Part 3

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

Build a SwiftUI app for iOS 15 Part 2

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

3 hrs

course logo

Build a SwiftUI app for iOS 15

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

React Livestreams

Learn how we can use React Hooks to build web apps using libraries, tools, apis and frameworks

4 hrs

course logo

Design Founder Livestreams

A journey on how we built DesignCode covering product design, management, analytics, revenue and a good dose of learning from our successes and failures

2 hrs

course logo

SwiftUI Advanced Handbook

An extensive series of tutorials covering advanced topics related to SwiftUI, with a main focus on backend and logic to take your SwiftUI skills to the next level

4 hrs

course logo

iOS Design Handbook

A complete guide to designing for iOS 14 with videos, examples and design files

2 hrs

course logo

SwiftUI Handbook

A comprehensive series of tutorials covering Xcode, SwiftUI and all the layout and development techniques

7 hrs

course logo

Build a web app with React Hooks

Learn how we built the new Design+Code site with React Hooks using Gatsby, Netlify, and advanced CSS techniques with Styled Components.

4 hrs

course logo

UI Design Handbook

A comprehensive guide to the best tips and tricks for UI design. Free tutorials for learning user interface design.

2 hrs

course logo

Figma Handbook

A comprehensive guide to the best tips and tricks in Figma

6 hrs

course logo

SwiftUI for iOS 14

Build a multi-platform app from scratch using the new techniques in iOS 14. We'll use the Sidebar and Lazy Grids to make the layout adaptive for iOS, iPadOS, macOS Big Sur and we'll learn the new Matched Geometry Effect to create beautiful transitions between screens without the complexity. This course is beginner-friendly and is taught step-by-step in a video format.

3 hrs

course logo

SwiftUI Livestreams

This is a compilation of the SwiftUI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

19 hrs

course logo

UI Design Livestreams

This is a compilation of the UI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

26 hrs

course logo

UI Design for Developers

In this course we'll learn how to use design systems, set up break points, typography, spacing, navigation, size rules for adapting to the iPad, mobile and web versions, and different techniques that translate well from design to code.

3 hrs

course logo

Build an app with SwiftUI Part 3

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build an app with SwiftUI Part 2

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build a full site in Webflow

Webflow is a design tool that can build production-ready experiences without code. You can implement CSS-driven adaptive layouts, build complex interactions and deploy all in one tool. Webflow also comes with a built-in content management system (CMS) and Ecommerce for creating a purchase experience without the need of third-party tools.

3 hrs

course logo

Advanced Prototyping in ProtoPie

ProtoPie is a cross-platform prototyping tool that creates prototypes nearly as powerful as those made with code, with half of the efforts, and zero code. It's perfect for designers who want to quickly experiment with advanced interactions using variables, conditions, sensors and more.

3 hrs

course logo

Build an app with SwiftUI Part 1

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

React Native for Designers Part 2

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

3 hrs

course logo

React Native for Designers

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

5 hrs

course logo

Design System in Figma

Learn how to use and design a collaborative and powerful design system in Figma. Design Systems provide a shared library of reusable components and guidelines and that will let you build products much faster

3 hrs

course logo

React for Designers

Learn how to build a modern site using React and the most efficient libraries to get your site/product online. Get familiar with Grid CSS, animations, interactions, dynamic data with Contentful and deploying your site with Netlify.

3 hrs

course logo

Swift Advanced

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

9 hrs

course logo

Learn Swift

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

4 hrs

course logo

Learn Sketch

Learn Sketch a design tool entirely vector-based and focused on user interface design

5 hrs

course logo

Learn iOS 11 Design

Learn colors, typography and layout for iOS 8

1 hrs