How to add a custom class to an element
Learn how to manually add a custom CSS class to an element using an override in Framer.
FAQ
How do I add a custom class to an element in Framer?
To add a custom class to an element in Framer, create an override that modifies the className property of the element. This method allows you to append your custom class to the element’s existing className.
Can you provide an example of adding a custom class using an override?
Yes. Here is an example override that appends the class 'test' to an element’s existing className: import type { ComponentType } from "react"; export function withClass(Component): ComponentType { return (props) => { props.className += " test"; // Remember to add a space return <Component {...props} />; }; }
Are there any important considerations when manually adding classes in Framer?
This approach is ideal for minor adjustments. Keep in mind that delving too deeply into manual modifications may limit the support Framer can provide.
Updated