Finsweet Class Adder
You can connect Finsweet Class Adder to manage CSS classes dynamically in Webflow using interactions, CMS data, and visual workflows.
How to integrate Finsweet Class Adder with Webflow
Dynamic class manipulation in Webflow enables conditional styling, user interaction states, and automated visual updates without rebuilding components. This integration responds to CMS data, user actions, and external triggers to apply CSS classes programmatically.
Integrate through custom code with data attributes for basic implementations or use Webflow's REST API to manage custom scripts for server-triggered updates.
Note: Finsweet Class Adder was created in 2020 and is no longer actively maintained. For new projects, consider using Finsweet Attributes v2 or Webflow's native interactions. This guide documents Class Adder for existing implementations only.
Script embed and data attributes
Add the Class Adder library through Webflow's custom code settings to enable dynamic class management across your site. Configure behavior through HTML data attributes without writing JavaScript.
Add <script src="https://cdn.finsweet.com/class-adder/v1.0.0/classAdder.min.js"></script> to your site's footer code through Site settings > Custom code. The library initializes automatically after publishing.
Configure elements using data attributes:
data-class-adder-trigger="click"applies classes when elements are clickeddata-class-adder-trigger="hover"applies classes during mouse hover statesdata-class-adder-trigger="scroll"activates classes when elements enter viewportdata-class-adder-trigger="load"applies classes immediately on page loaddata-class-adder-targetspecifies target elements using any valid CSS selectordata-class-adder-classdefines the class name to apply
This approach works with CMS collections. Apply data attributes to collection list items and the library handles dynamic content without additional configuration.
Common use cases include z-index management for layered interfaces, theme switching for dark mode toggles, visibility controls for conditional content, and state management for multi-step forms.
Build with Webflow REST API to manage custom scripts
Use Webflow's REST API to register and deploy custom JavaScript when you need server-triggered styling updates or integration with external systems. The API manages script registration and deployment while the scripts themselves handle client-side class manipulation.
Authenticate with Webflow's OAuth system using sites:read and custom_code:write scopes. Include the bearer token in API requests with headers Authorization: Bearer <token> and Accept-Version: 2.0.0.
Webflow REST API endpoints for managing custom code:
POST /sites/{site_id}/registered_scripts/inlineregisters inline scripts withdisplayName,version,sourceCode, andcanCopyparametersPOST /sites/{site_id}/registered_scripts/hostedregisters hosted scripts from external URLs withhostedLocationandintegrityHashparametersPUT /sites/{site_id}/custom_codeapplies site-wide custom code to head or footerPUT /pages/{page_id}/custom_codeapplies page-specific custom codeGET /sites/{site_id}/collectionsretrieves collection data for CMS-based stylingPOST /sites/{site_id}/webhooksconfigures automated triggers for events likecollection_item_created
Webhook-triggered class management
Connect external systems to your Webflow site's visual states using Webflow's webhook system. Your server receives CMS events and responds by updating content that custom scripts then style according to your rules.
Note: This approach requires server infrastructure to receive and process webhooks. For most styling needs without external system integration, use Webflow's native interactions or Finsweet Attributes v2 instead.
Create webhooks that monitor CMS changes with POST requests to https://api.webflow.com/v2/sites/{site_id}/webhooks:
{
"triggerType": "collection_item_created",
"url": "https://your-server.com/webhook",
"filter": { "collectionId": "your_collection_id" }
}
Available webhook events include collection_item_created for new CMS items, collection_item_changed for item updates, form.submission for form completions, and site.publish for deployment notifications.
Your webhook endpoint receives payloads containing id, siteId, collectionId, and fieldData with all CMS field values. Validate webhooks using the x-webflow-signature header with HMAC SHA-256 verification and the x-webflow-timestamp header to prevent replay attacks. Webflow allows a 5-minute tolerance window for timestamp validation.
Monitor webhook health through GET /sites/{site_id}/webhooks to track active integrations.
What you can build
Dynamic class management responds to user interactions, CMS data, and external events for automated styling changes.
- Alternating collection layouts: Build blog lists or product grids where every third item displays in a featured layout with different typography and sizing as content editors add new CMS items
- Interactive filtering interfaces: Create portfolio pages where category buttons apply visual styles to matching items while dimming others through class toggles
- Conditional content visibility: Design multi-step forms or gated content that reveals based on user progress using scroll position or click events
- Theme switching systems: Implement dark mode toggles or brand theme selectors that apply styling changes across the site through a single class addition to the body element
Frequently asked questions
Add the Class Adder library through Webflow's custom code settings in Site settings > Custom code > Footer code. Paste
<script src="https://cdn.finsweet.com/class-adder/v1.0.0/classAdder.min.js"></script>and publish your site to activate the library. After publishing, Class Adder capabilities become available through data attributes on any element.For programmatic script injection using the REST API, register scripts through the custom code endpoints. This approach works for automated site setup or when managing multiple Webflow projects through code.
Class Adder works with CMS collections through data attributes. Apply attributes directly to collection list items in Webflow and the library processes each item individually when the page loads.
Access CMS data programmatically through Webflow's Collections API to retrieve field values and item metadata. Combine this with Class Adder to apply styling based on field values, publication dates, or custom logic that evaluates content attributes.
Note: Finsweet's CMS Library (previously used for pattern-based styling) is officially deprecated. For new projects requiring alternating layouts or featured items, use Finsweet Attributes v2 instead.
Class Adder supports four built-in trigger types configured through data attributes. Set
data-class-adder-trigger="click"for click events,"hover"for mouse hover states,"scroll"for viewport intersection, and"load"for immediate page load activation. Each trigger type works without additional JavaScript. Configure the trigger attribute, define your target withdata-class-adder-target, and specify the class withdata-class-adder-class.For advanced scenarios, combine Class Adder with Webflow's webhook system to trigger styling changes from external events like form submissions, CMS updates, or e-commerce transactions. Your server receives webhook notifications and updates content that Class Adder then styles according to your configuration.
Define targets using the
data-class-adder-targetattribute with any valid CSS selector. Use class selectors like.target-element, ID selectors like#specific-item, or complex selectors like.parent .child:nth-child(2)to control which elements receive classes. The library supports all CSS selector syntax including pseudo-classes and combinators.For CMS collections, target elements within collection items using descendant selectors. Apply the trigger attribute to a parent element and use
data-class-adder-target=".collection-item .feature-image"to target specific children across all items in the collection.Class Adder adds and removes classes based on trigger types. Click triggers toggle classes by default, clicking once adds the class and clicking again removes it. Hover triggers remove classes automatically when the mouse leaves the element. Scroll triggers remove classes when elements leave the viewport, though you can configure persistence through additional attributes.
For programmatic control beyond built-in triggers, write custom JavaScript that manipulates classes directly using standard DOM methods. This approach works when coordinating Class Adder with other JavaScript functionality or when building complex state management systems.
Description
Finsweet Class Adder is a client-side JavaScript library that adds and removes CSS classes on elements based on user interactions, CMS data, and custom triggers.
This integration page is provided for informational and convenience purposes only.

Class Adder for Webflow Interactions
Class Adder is a tool to add/remove a class from an element. You can trigger the add/remove on click, hover, scroll in/out of view, or page load. This is an add-on to Webflow Interactions.


