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.
This article explains how to modify an element’s className by creating an override. This approach is useful when you need to apply a custom class for styling or targeting purposes.
Create an override
To add a custom class, you’ll need to use an override that modifies the element’s className property. Overrides let you extend or adjust an element’s behavior without changing its core structure.
Write the override code
Use the override to append a custom class to the existing className. Always include a leading space so the new class is separated correctly.
Once applied, the element’s rendered HTML will include the additional class, similar to the example below:
After adding the override:
Publish your project in Framer.
Open your site in a browser.
Use the browser’s web inspector to select the element.
Confirm that the custom class appears in the element’s
classattribute.
Important notes
This method works best for small, targeted adjustments.
Extensive manual modifications can limit the level of support Framer can provide if issues arise.
Updated