Ever built a Webflow CMS list and thought,
"Wow, this looks great! But waitβ¦ how do users search for stuff?" π©
Unfortunately, Webflow doesnβt have a built-in CMS search. But donβt worryβtoday, weβll fix that! π
In this guide, weβll cover two easy ways to add search functionality:
1οΈβ£ The No-Code Way β Using Finsweet Attributes
2οΈβ£ The Custom Code Way β Using JavaScript for Real-Time Filtering
Letβs gooo! π
β
β
πΉ Part 1: Adding CMS Search Using Finsweet Attributes (No Code!)
π Website: https://www.finsweet.com/attributes/cms-search
Finsweet Attributes is a free tool that extends Webflowβs functionality without writing code. It makes adding search super simple.
β
π Step 1: Set Up Your Webflow CMS Page
Before we start, you need:
β
A Webflow CMS Collection List (e.g., blog posts, products, team members)
β
A Search Input Field
If you donβt have a search field yet, just add:
- An Input Field (
Form β Input
) - A CMS Collection List (your list of items)
β
π Step 2: Add Finsweet Attributes to Webflow
1οΈβ£ Select your CMS Collection List
- Go to the Element Settings Panel
- Add the custom attribute:
- Name:
fs-cmssearch-element
- Value:
list
- Name:
2οΈβ£ Select your Search Input Field
- Add another custom attribute:
- Name:
fs-cmssearch-element
- Value:
input
- Name:
Your setup should look like this:
πΈ (Insert image of Webflow settings panel with attributes added)
β
β‘ Step 3: Add the Finsweet Script
Go to Page Settings β Custom Code (Before </body>
) and paste this:
html
CopyEdit
<script src="https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmssearch@1/cmssearch.js"></script>
β
β Done! Now Test Your Search
π Type anything in the search box, and watch your CMS list filter dynamically! π
π₯ Why Use Finsweet Attributes?
βοΈ No coding required
βοΈ Works instantly with large CMS lists
βοΈ Super fast and reliable
But what if you want full control over the search behavior? Thatβs where custom JavaScript comes in. π
β
β
β
πΉ Part 2: Implementing a Custom JavaScript Search Function (For Developers) π
Now, letβs build a real-time search function that filters items as you type.
β
π Step 1: Add the HTML Elements
Inside your Webflow project, add:
- A Search Input Field (give it the class
search-input
) - A CMS Collection List (give it the class
cms-list
) - Each CMS item should have a wrapper (
cms-item
) and a title inside (cms-title
)
Your Webflow structure should look like this:
πΈ (Insert image of Webflow Navigator panel with correct class names)
β
β‘ Step 2: Add the Custom JavaScript
Now, letβs add the magic! Go to Page Settings β Custom Code (Before </body>
) and paste this:
<script>
document.addEventListener("DOMContentLoaded", function () {
const searchInput = document.querySelector(".search-input");
const cmsItems = document.querySelectorAll(".cms-item");
const cleanText = (text) => {
return text
.toLowerCase()
// Remove accents/diacritics
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
// Remove punctuation
.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()'"]/g, " ")
// Replace multiple spaces
.replace(/\s+/g, " ")
.trim();
};
// Optional: Cache cleaned titles for better performance
const cleanTitles = new Map();
cmsItems.forEach(item => {
const titleElement = item.querySelector(".cms-title");
if (titleElement) {
cleanTitles.set(item, cleanText(titleElement.innerText));
}
});
let timeout;
searchInput.addEventListener("input", function () {
clearTimeout(timeout);
timeout = setTimeout(() => {
const filterText = cleanText(searchInput.value);
const searchWords = filterText.split(" ").filter(word => word.length > 0);
// If search is empty, show all items
if (searchWords.length === 0) {
cmsItems.forEach(item => item.style.display = "block");
return;
}
cmsItems.forEach((item) => {
if (!cleanTitles.has(item)) return;
const titleWords = cleanTitles.get(item).split(" ");
const isMatch = searchWords.every(searchWord =>
titleWords.some(titleWord =>
titleWord.includes(searchWord)
)
);
item.style.display = isMatch ? "block" : "none";
});
}, 300);
});
});
</script>
β
β Done! Now Test Your Custom Search
π Type in the search bar, and the CMS items will dynamically filter in real time as you type. π―
π₯ Why Use Custom JavaScript?
βοΈ No external dependencies β Works without Finsweet
βοΈ More control β Customize it to filter by multiple fields
βοΈ Super lightweight β Works instantly
β
π Finsweet Attributes vs. Custom JavaScript β Which One to Use?
β
π― Final Thoughts
And there you have it! π You just learned two powerful ways to add real-time search to your Webflow CMS List page.
π Which One Should You Choose?
π‘ If you donβt want to code, use Finsweet Attributes.
π‘ If you want full control, go with custom JavaScript.
Either way, your Webflow site now has a search function that actually works! π₯
β
β