Creating Dynamic Filtering with F'in Sweet CMS Library in Webflow

Published on
May 4, 2020

The F'in Sweet CMS Library for Webflow, as demonstrated in the video tutorial by Joe Kruk from Vince Wheat, is a powerful tool for creating dynamic filtering on websites built with Webflow. This article will provide an in-depth guide on how to utilize the F'in Sweet CMS Library to create a live example of the filter component. The focus will be on understanding the filter component, setting up exclusive filter types, and integrating the F'in Sweet CMS Library script to achieve dynamic filtering on a Webflow site.

Understanding the Filter Component

The filter component in Webflow's CMS allows for the filtering of collection items based on the text content within those items. Each item in a collection represents a piece of text that can be used as a filter criterion. It's important to note that the text used for filtering is controlled inside the Webflow CMS. This means that elements like year, color, brand, and web design can serve as filter criteria and can be updated through the Webflow CMS.

The video tutorial showcases a collection list item with text elements such as year, color, brand, and web design as examples. These text elements can be updated through the Webflow CMS, and any changes made to them will reflect in how the items are filtered in the grid.

Setting Up Exclusive Filter Types

The tutorial demonstrates the concept of exclusive filter types, where only one option can be selected at a time. This means that when a user selects a filter option, it becomes the active filter, and any previously active filter is deselected. As a result, the grid updates to display only the items relevant to the newly selected filter option.

Implementing Exclusive Filter Types in Webflow

To implement exclusive filter types in Webflow using the F'in Sweet CMS Library, the following steps can be followed:

  1. Structure and Classes: Ensure that the collection list element has a class name of collection-list. Additionally, the parent wrapper of the filter buttons in the filter group should have a class of filters-wrapper.

  2. Data Attributes: Each of the filter buttons should have a data-attribute named filter-by with a value corresponding to the filter criterion. For example, a button for filtering by the color blue should have the data-attribute filter-by="blue".

  3. Defining Filter Groups: Start by defining the filter groups using the F'in Sweet CMS Library. Each filter group is defined as an array, with the filter wrapper and filter type specified for each group. For exclusive filter types, the filter type would be set to exclusive.

Creating the Filter Array and Animation Settings

After setting up the structure and defining the filter groups, the next step is to create and run the filter instance in the script by utilizing the F'in Sweet CMS Library.

  1. Creating a New Instance: Create a new instance of the F'in Sweet CMS Library targeting the collection list element and store it in a variable, such as projects-grid.

  2. Establishing the Array: Define an array that represents the filter groups. Each item in the array corresponds to a filter group and includes the filter wrapper and filter type. In the case of exclusive filter types, set the filter type to exclusive.

  3. Running the Filter Component: Run the filter component on the collection list element, providing the filter array and specifying the active class for the filter buttons. Additionally, optional animation settings can be added to create visual effects when the grid updates.

Integrating the F'in Sweet CMS Library Script

It is crucial to include the F'in Sweet CMS Library script in the Webflow project to enable dynamic filtering functionalities. The video tutorial suggests adding the script before the closing body tag.

Script Integration Steps

  1. Include the Library Script: Add the F'in Sweet CMS Library script before the closing body tag of the Webflow project. This script will be provided by the library and should be hosted to ensure proper functionality.

  2. Project-Specific Script: Create a project-specific script to interact with the F'in Sweet CMS Library. This script should include the instantiation of the library, definition of filter arrays, and any additional customization options for the filter component.

  3. Defining Animation Settings: If desired, animation settings can be included in the project-specific script to control the visual behavior of the grid when items are filtered.

By following these integration steps, the F'in Sweet CMS Library can be seamlessly integrated into a Webflow project to enable dynamic filtering based on the defined filter criteria.

Conclusion

The F'in Sweet CMS Library provides a robust solution for implementing dynamic filtering on Webflow websites, allowing for enhanced user experiences and efficient content organization. By understanding the filter component and exclusive filter types, as well as integrating the F'in Sweet CMS Library script, Webflow users can take full advantage of the library's capabilities to create engaging and interactive filtering functionalities within their projects.