<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Webflow Sprinkles - Medium]]></title>
        <description><![CDATA[We publish short articles featuring easy-to-use coding tips for fellow Webflow designers. Our goal is to help you create beautiful, intuitive and powerful websites even if you aren’t a software developer. Supported by Tech for Bio, a web studio from Paris. - Medium]]></description>
        <link>https://medium.com/webflow-sprinkles?source=rss----e59e9c50165b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Webflow Sprinkles - Medium</title>
            <link>https://medium.com/webflow-sprinkles?source=rss----e59e9c50165b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:19:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/webflow-sprinkles" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Phone number validation and formatting in Webflow forms]]></title>
            <link>https://medium.com/webflow-sprinkles/phone-number-validation-and-formatting-in-webflow-forms-9606eb1d8c33?source=rss----e59e9c50165b---4</link>
            <guid isPermaLink="false">https://medium.com/p/9606eb1d8c33</guid>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[phone-number]]></category>
            <category><![CDATA[alpinejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webflow]]></category>
            <dc:creator><![CDATA[Jarek Lipski]]></dc:creator>
            <pubDate>Thu, 19 May 2022 16:06:08 GMT</pubDate>
            <atom:updated>2022-05-29T12:54:22.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x9GM9GpzBGpzTwIC" /><figcaption>Photo by <a href="https://unsplash.com/@pawel_czerwinski?utm_source=medium&amp;utm_medium=referral">Pawel Czerwinski</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Sometimes it’s useful to ask your site visitor to enter their phone number into a contact form. To improve the quality of gathered phone numbers, it’s important to validate them before submitting the form. To further limit the number of mistakes, it’s also helpful to format the number while typing, by adding a space every few digits.</p><h3>TL;DR</h3><p>If you are in a hurry and just want to see an example of how to format and validate a phone number in a Webflow form, copy the following code at the bottom of the body element:</p><pre>&lt;script src=&quot;<a href="https://cdn.jsdelivr.net/npm/libphonenumber-js@1/bundle/libphonenumber-min.js">https://cdn.jsdelivr.net/npm/libphonenumber-js@1/bundle/libphonenumber-min.js</a>&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script&gt;<br>const DEFAULT_COUNTRY = &#39;FR&#39;<br>const formatter = new libphonenumber.AsYouType(DEFAULT_COUNTRY)<br>const phoneInput = document.getElementById(&#39;myphone&#39;)<br>phoneInput.addEventListener(&#39;input&#39;, function (event) {<br>  formatter.reset()<br>  const newValue = formatter.input(phoneInput.value)<br>  phoneInput.value = newValue<br>  if (!libphonenumber.isValidPhoneNumber(newValue, DEFAULT_COUNTRY)) {<br>    phoneInput.setCustomValidity(&#39;Invalid phone number&#39;)<br>  } else {<br>    phoneInput.setCustomValidity(&#39;&#39;)<br>  }<br>})<br>&lt;/script&gt;</pre><p>Please note that you need to adjust the phone input field element ID and the default country above.</p><h3>Getting started</h3><p>For the heavy lifting, we’ll be using the libphonenumber-js library:</p><p><a href="https://gitlab.com/catamphetamine/libphonenumber-js">Nikolay Kuchumov / libphonenumber-js · GitLab</a></p><p>To initialize it, add the following script tag at the end of the &lt;body&gt; element using an Embed element:</p><pre>&lt;script src=&quot;<a href="https://cdn.jsdelivr.net/npm/libphonenumber-js@1.9.52/bundle/libphonenumber-min.min.js">https://cdn.jsdelivr.net/npm/libphonenumber-js@1/bundle/libphonenumber-min.js</a>&quot;&gt;&lt;/script&gt;</pre><blockquote><em>To learn more about using custom code in Webflow, refer to my article </em><a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0"><em>“</em></a><a href="https://medium.com/webflow-sprinkles/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0?source=your_stories_page-------------------------------------"><em>How to add custom code to Webflow</em></a><a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0"><em>”</em></a><em>.</em></blockquote><h3>Validate and format phone numbers</h3><p>After completing this tutorial, you should see a simple form validating and formatting a phone number similar to this one:</p><figure><img alt="Enter phone number animation" src="https://cdn-images-1.medium.com/max/322/1*yKvU6unprxgQSalhMT3Urg.gif" /></figure><h4>1. Create a Form Block element</h4><p>Create a standard Form Block element and delete any existing fields from it, leaving only the Submit Button:</p><figure><img alt="Form Block element" src="https://cdn-images-1.medium.com/max/82/1*SPmR8IVD4LgrTeXEmufFSQ.png" /></figure><figure><img alt="Empty Form Block element" src="https://cdn-images-1.medium.com/max/153/1*Rcym5ht8QCFUQzpe9f2ziA.png" /></figure><h4>2. Add a phone field to the form</h4><p>Add the Label and Input elements to the form:</p><figure><img alt="Label and Input element icons" src="https://cdn-images-1.medium.com/max/166/1*ZmgpO6DDORaPjzlD8HNtgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/148/1*PjLLXYRMB-Q6yKaRJHZDvw.png" /></figure><h4>3. Set up the phone field</h4><p>Open the Field settings and set the type of the Input field to phone. Also set the field name to Phone, remove the placeholder text for clarity and keep the Required option enabled:</p><figure><img alt="Phone field setup" src="https://cdn-images-1.medium.com/max/238/1*K7MQ3nynnp0-wpshOcVeVQ.png" /></figure><p>Next, set an ID of the field to myphone, so you can refer to it later:</p><figure><img alt="Field ID" src="https://cdn-images-1.medium.com/max/238/1*lissVCD9a3XqUxTGe1GRZA.png" /></figure><h4>4. Format the phone number</h4><p>To format the phone number while it’s being typed, add the following code to the Embed element below the libphnonenumber-js library initialization code:</p><pre>&lt;script&gt;<br>const DEFAULT_COUNTRY = &#39;FR&#39;<br>const formatter = new libphonenumber.AsYouType(DEFAULT_COUNTRY)<br>const phoneInput = document.getElementById(&#39;myphone&#39;)</pre><pre>phoneInput.addEventListener(&#39;input&#39;, function (event) {<br>  formatter.reset()<br>  const newValue = formatter.input(phoneInput.value)<br>  phoneInput.value = newValue<br>})<br>&lt;/script&gt;</pre><p>You should end up with the element structure similar to the one below in Webflow Designer:</p><figure><img alt="Final element structure" src="https://cdn-images-1.medium.com/max/184/1*xQEhZs3zGngTvum8V8MXgw.png" /></figure><p>You can deploy your site at this point, and any phone numbers entered into the form should appear nicely formatted:</p><figure><img alt="International phone number" src="https://cdn-images-1.medium.com/max/307/1*Od3G6MTDuwxEffxz24i4qw.png" /></figure><p>Please note the DEFAULT_COUNTRY variable. It sets the country of the phone number, if the user didn’t specify it via the country calling code. In other words, the below phone number is treated as French by default and formatted accordingly:</p><figure><img alt="Phone number without country calling code" src="https://cdn-images-1.medium.com/max/305/1*oQSR-c9AU_NWwIMTHKdkZg.png" /></figure><h4>5. Validate the phone number</h4><p>At this point, the user can still submit an invalid phone number. Add the following code at the end of the input event listener to validate it:</p><pre>&lt;script&gt;<br>...<br>if (!libphonenumber.isValidPhoneNumber(newValue, DEFAULT_COUNTRY)) {<br>    phoneInput.setCustomValidity(&#39;Invalid phone number&#39;)<br>  } else {<br>    phoneInput.setCustomValidity(&#39;&#39;)<br>  }<br>})<br>&lt;/script&gt;</pre><p>After deployment, the form should not allow the submitting of an invalid phone number:</p><figure><img alt="Invalid phone number" src="https://cdn-images-1.medium.com/max/312/1*315Yv5Dj-uppzfQ6McJRRg.png" /></figure><h4>Bonus: Use the phone component from the webflow-alpinejs library</h4><p>I maintain a small library integrating an excellent <a href="http://alpinejs.dev/">Alpine.js microframework</a> with Webflow. It contains a bunch of reusable components, and among them the phone component. You can simply use this instead of following the above steps.</p><p><a href="https://github.com/loomchild/webflow-alpinejs">GitHub - loomchild/webflow-alpinejs: A connector / wrapper to allow using Alpine.js in Webflow designer.</a></p><p>First, initialize the library by adding the following script tag at the end of the &lt;body&gt; element:</p><pre>&lt;script src=&quot;<a href="https://cdn.jsdelivr.net/combine/npm/@loomchild/webflow-alpinejs@2,npm/@loomchild/webflow-alpinejs@2/dist/components/phone.min.js">https://cdn.jsdelivr.net/combine/npm/@loomchild/webflow-alpinejs@2,npm/@loomchild/webflow-alpinejs@2/dist/components/phone.js</a>&quot;&gt;&lt;/script&gt;</pre><p>Next, add the following style tag at the beginning of the &lt;body&gt; element:</p><pre>&lt;link href=&quot;https://cdn.jsdelivr.net/npm/@loomchild/webflow-<br>alpinejs@2/dist/style.css&quot; rel=&quot;stylesheet&quot;&gt;</pre><p>Finally, add the following custom properties to the phone field:</p><pre>x-data=&quot;phone({ country: &#39;FR&#39; })&quot;<br>x-bind=&quot;input&quot;</pre><p>Voilà, that’s it!</p><blockquote>You can learn more about using Alpine.js in Webflow from my <a href="https://medium.com/webflow-sprinkles/webflow-alpine-js-d53d77e3293">“Webflow + Alpine.js” article</a>.</blockquote><p>Thank you for reading, I hope you enjoyed this tutorial! For more Webflow coding tips for designers, please follow <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a>. If you have any feedback, please post a comment below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9606eb1d8c33" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webflow-sprinkles/phone-number-validation-and-formatting-in-webflow-forms-9606eb1d8c33">Phone number validation and formatting in Webflow forms</a> was originally published in <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privacy-respecting Analytics with Matomo and Webflow]]></title>
            <link>https://medium.com/webflow-sprinkles/privacy-respecting-analytics-with-matomo-and-webflow-633a68cb5358?source=rss----e59e9c50165b---4</link>
            <guid isPermaLink="false">https://medium.com/p/633a68cb5358</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webflow]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[matomo]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Jarek Lipski]]></dc:creator>
            <pubDate>Wed, 20 Apr 2022 16:54:36 GMT</pubDate>
            <atom:updated>2022-04-20T17:12:26.846Z</atom:updated>
            <content:encoded><![CDATA[<h4>Tutorial on configuring an alternative web analytics solution</h4><figure><img alt="Matomo web analytics logo" src="https://cdn-images-1.medium.com/max/1024/1*0EsXoPXHZNsPZhMcVJO9MQ.png" /></figure><p><a href="https://matomo.org/">Matomo</a>, formerly Piwik, is an open-source web analytics solution. What sets it apart from competitors, such as Google Analytics, are its <a href="https://matomo.org/privacy/">privacy features</a>. It allows you to anonymize IP addresses, customize data retention and even enable <a href="https://matomo.org/cookie-consent-banners/">cookie-less tracking</a>. This last feature, in addition to improving visitor privacy, can allow you to completely get rid of the annoying cookie popup. With Matomo, visitor data is never shared between accounts, so users can’t be permanently tracked across websites. It can also be used <em>in addition</em> to another analytics solution, to give you an idea of how many visitors refuse or block cookies completely.</p><h3>Configure Matomo with Webflow</h3><h4>1. Initialize Matomo instance</h4><p>There are two options available: you can either subscribe to <a href="https://matomo.org/matomo-cloud/">Matomo Cloud</a> or install <a href="https://matomo.org/matomo-on-premise/">Matomo on your own server</a> for free. Regardless of the option you choose, the following steps in this tutorial remain the same.</p><blockquote>Note that self-hosted Matomo is best suited for advanced users and it allows additional customization via plugins.</blockquote><h4>2. Add your Webflow website to Matomo</h4><p>Add your website domain to Matomo. Go to Administration ⚙ → Websites → Manage. Click on the Add a new measurable button and select Website.</p><figure><img alt="Screenshot how to create new website in Matomo" src="https://cdn-images-1.medium.com/max/1024/1*jnOBboJGvNF21cAVkR5I1Q.png" /></figure><blockquote>Each Matomo instance can support multiple websites.</blockquote><p>Enter your website name, URLs and a time zone:</p><figure><img alt="Specify website name and URLs" src="https://cdn-images-1.medium.com/max/635/1*Ojs0RXRGLoOO8de7FfQngg.png" /></figure><blockquote>It’s not necessary to specify both the root and www. subdomain.</blockquote><h4>3. Copy the tracking code from Matomo to Webflow</h4><p>Click on the View tracking code link next to the newly created website.</p><figure><img alt="View tracking code link" src="https://cdn-images-1.medium.com/max/223/1*dkEYklLomkd36KdOb_KM4w.png" /></figure><p>Copy the entire JavaScript code snippet on the black background.</p><figure><img alt="Matomo tracking code" src="https://cdn-images-1.medium.com/max/496/1*K_M9kjeaveZzfYVnbDMj2w.png" /></figure><p>Paste the code in your Webflow Project Settings → Custom Code, at the end of the &lt;head&gt; element. Click Save Changes and publish your website.</p><figure><img alt="Paste Matomo code to Webflow settings" src="https://cdn-images-1.medium.com/max/609/1*XNxA3BrpTIRcgs1cczg4OQ.png" /></figure><blockquote>To learn more about using custom code in Webflow, refer to my article <a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">“</a><a href="https://medium.com/webflow-sprinkles/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0?source=your_stories_page-------------------------------------">How to add custom code to Webflow</a><a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">”</a>.</blockquote><h4>4. Filter internal Webflow traffic from analytics</h4><p>Webflow bot accesses your site every time you make any changes to it. To avoid such visits polluting your real user data, you need to filter them out from analytics. It’s easiest to identify them by the User Agent containing the string webflow.</p><p>To filter out this traffic, go to Administration ⚙ → Websites → Settings and add the above string to the Global list of user agents to exclude:</p><figure><img alt="Exclude Webflow user agent in Matomo to filter internal traffic" src="https://cdn-images-1.medium.com/max/619/1*DAU3XCQN6e9Xzv-AmysrNw.png" /></figure><h4>5. Test if it works</h4><p>Now, after visiting your site, you should see the traffic on the real-time panel:</p><figure><img alt="Real-time visits on Matomo" src="https://cdn-images-1.medium.com/max/372/1*98a1mymBKis3eHABOkaBCg.png" /></figure><blockquote>For low-traffic sites you may later decide to filter out your own traffic as well. See <a href="https://matomo.org/faq/how-to/faq_126/">How do I exclude my traffic FAQ</a> for more information. Note however, that you won’t be able to test Matomo analytics anymore.</blockquote><p>After the initial setup, I recommend you explore the <a href="https://matomo.org/guides/">official Matomo documentation</a> to learn about available features, such as available reports, integrated tag manager, heatmaps, etc. Furthermore, please check the <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-webflow/">official tutorial</a> if you have any questions about configuration. Please note that I am not affiliated with Matomo in any way, I just enjoy using their software.</p><p>Thank you for reading, I hope you found this quick tutorial useful. If you did, please check out the other <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a> articles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=633a68cb5358" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webflow-sprinkles/privacy-respecting-analytics-with-matomo-and-webflow-633a68cb5358">Privacy-respecting Analytics with Matomo and Webflow</a> was originally published in <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement a multi-step form in Webflow with Alpine.js]]></title>
            <link>https://medium.com/webflow-sprinkles/implement-a-multi-step-form-in-webflow-with-alpine-js-2ec1a5308a6a?source=rss----e59e9c50165b---4</link>
            <guid isPermaLink="false">https://medium.com/p/2ec1a5308a6a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[webflow]]></category>
            <category><![CDATA[alpinejs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jarek Lipski]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 13:30:28 GMT</pubDate>
            <atom:updated>2022-05-19T10:58:46.125Z</atom:updated>
            <content:encoded><![CDATA[<h4>A tutorial on how to split web forms into pages.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wxpOOVLskWUOevPU" /><figcaption>Photo by <a href="https://unsplash.com/@howlingred70?utm_source=medium&amp;utm_medium=referral">howling red</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Simple forms are great for login, newsletter subscription, contact, etc. However, if your form has more than a few fields, spreading them across multiple pages not only improves the user experience but can also increase the conversion rate. In multi-step forms, it’s also important to validate the fields before advancing to the next page.</p><p>In this short tutorial, you will learn how to build a flexible multi-step form in Webflow using Alpine.js microframework. To give you a flavor of how the results will look, here’s a <a href="https://www.wemaintain.com/fr/forms/prix-form-s">price form</a> I have recently built using the technique described in this article:</p><figure><img alt="Animation showing completed multi-step pricing form." src="https://cdn-images-1.medium.com/max/600/1*rXEPzcxWlQs1ATQ4teHl7g.gif" /></figure><h3>Getting started</h3><h4>Initialize Alpine.js</h4><p>First, you need to initialize the <a href="https://alpinejs.dev/">Alpine.js</a> micro-framework. You can do this via <a href="https://github.com/loomchild/webflow-alpinejs">webflow-alpinejs connector</a>.</p><p>Include the following script tag at the end of the &lt;body&gt; element:</p><pre>&lt;script src=&quot;https://cdn.jsdelivr.net/npm/@loomchild/webflow-alpinejs@2/dist/index.js&quot;&gt;&lt;/script&gt;</pre><p>and add the following style tag at the beginning of the &lt;body&gt; element or somewhere in the &lt;head&gt; element:</p><pre>&lt;link href=&quot;https://cdn.jsdelivr.net/npm/@loomchild/webflow-<br>alpinejs@2/dist/style.css&quot; rel=&quot;stylesheet&quot;&gt;</pre><blockquote>To learn more about using custom code in Webflow, refer to my article <a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">“</a><a href="https://medium.com/webflow-sprinkles/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0?source=your_stories_page-------------------------------------">How to add custom code to Webflow</a><a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">”</a>.</blockquote><h4>Use Alpine.js directives</h4><p>Alpine.js directives, used to define the behavior of your website, are declared as custom element attributes.</p><p>In this article, custom attributes will be described as follows:</p><pre>attribute-name=&quot;attribute-value&quot;</pre><p>which corresponds to the following setting in Webflow Designer:</p><figure><img alt="Adding custom attribute in Webflow." src="https://cdn-images-1.medium.com/max/220/1*PBx5Gh85Saca-rFxTczoXw.png" /></figure><blockquote>For more information about using Alpine.js in Webflow, refer to my article <a href="https://medium.com/webflow-sprinkles/webflow-alpine-js-d53d77e3293">“Webflow + Alpine.js”</a>.</blockquote><h3>Building the multi-step form</h3><p>Now you are ready to start building the multi-step form.</p><p>After completing this tutorial, your page should look as follows:</p><figure><img alt="Animation showing simple multi-step email form." src="https://cdn-images-1.medium.com/max/476/1*TvFyrM9RHU1H2QSL2xJknw.gif" /></figure><p>You should end up with the following element structure in Webflow Designer:</p><figure><img alt="Finished multi-step form element structure." src="https://cdn-images-1.medium.com/max/239/1*o_Xz-Je92uXWPNWirco7JQ.png" /></figure><h4>1. Create the Form element</h4><p>Create a Webflow Form Block element via the <em>Add elements</em> menu:</p><figure><img alt="Form Block element." src="https://cdn-images-1.medium.com/max/82/1*gYlKL09s0RzIYrs2ws1gJw.png" /></figure><p>Next, initialize the Form Block as wizard component using the x-data directive:</p><pre>x-data=&quot;wizard&quot;</pre><p>Finally, delete all form fields and the submit button.</p><figure><img alt="Form structure." src="https://cdn-images-1.medium.com/max/152/1*7Bvo0sxU9xm16PVZCA_AKw.png" /></figure><h4>2. Add the Slider element to the form</h4><p>Place the Slider element inside the Form wrapper:</p><figure><img alt="Slider element." src="https://cdn-images-1.medium.com/max/82/1*iy1DImELO6PCM9KPQ3aVbw.png" /></figure><p>Disable “Infinite repeat slides” and enable “Disable swipe gestures” settings:</p><figure><img alt="Slider element settings." src="https://cdn-images-1.medium.com/max/240/1*Xt0RZB_XmNMritRXNJK47Q.png" /></figure><p>Next, set the slider Background to transparent, and its Height to auto.</p><p>Finally, initialize the Slider as slider component using the x-data directive:</p><pre>x-data=&quot;slider&quot;</pre><figure><img alt="Form element with Slider element structure." src="https://cdn-images-1.medium.com/max/152/1*UkbAkrxs-fDG5Xmg2znwRQ.png" /></figure><blockquote>For more information about the Slider component refer to my article <a href="https://medium.com/webflow-sprinkles/interacting-with-the-webflow-slider-component-using-alpine-js-c154885feaed">“Interacting with the Webflow Slider Component using Alpine.js”</a>.</blockquote><h4>3. Populate the form with fields</h4><p>Add the Email Input text field to the first slide:</p><figure><img alt="Input element." src="https://cdn-images-1.medium.com/max/83/1*qUXpq5Kf22XS3XzkVVw5bw.png" /></figure><p>Make it required and validate the email format:</p><figure><img alt="Input element settings." src="https://cdn-images-1.medium.com/max/240/1*VsGYzhWBSGSBbSdLDaKeeA.png" /></figure><p>Similarly, add the Name Input text field to the second slide, making it optional.</p><p>Finally, add Label elements above each Input text field.</p><figure><img alt="Form fields." src="https://cdn-images-1.medium.com/max/163/1*tWhfLMlhkbwrMGaLwftLmQ.png" /></figure><h4>4. Add form navigation buttons</h4><p>First, hide the default next and previous buttons and the navigation dots.</p><p>Next, create the Continue Button on the first slide:</p><figure><img alt="Button element." src="https://cdn-images-1.medium.com/max/81/1*-yPVd3WiiH4TpMeNvPUuUw.png" /></figure><p>Add the x-on directive to the button to respond to the click event:</p><pre>x-on:click=&quot;nextStep()&quot;</pre><p>Create the Back Button on the second slide and add the following x-on directive to it:</p><pre>x-on:click=&quot;previousStep()&quot;</pre><p>Finally, create the Submit Form Button element on the second slide, which will submit the form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/82/1*Ch8cDpSri3l6OSQ-ipKuaA.png" /></figure><figure><img alt="Form with buttons." src="https://cdn-images-1.medium.com/max/239/1*o_Xz-Je92uXWPNWirco7JQ.png" /></figure><p>After publishing, the page should look similar to the <a href="#e071">animation at the beginning of this chapter</a> (you only need to add the desired styles).</p><h3>Conclusion</h3><p>Building multi-step forms in Webflow with Alpine.js is simple, yet flexible. It also allows you to validate the user input at each step. Now you can focus on designing usable and beautiful forms!</p><p>Thank you for reading, I hope you enjoyed this tutorial! For more Webflow coding tips for designers, please follow <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a>. If you have any feedback, please post a comment below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ec1a5308a6a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webflow-sprinkles/implement-a-multi-step-form-in-webflow-with-alpine-js-2ec1a5308a6a">Implement a multi-step form in Webflow with Alpine.js</a> was originally published in <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interacting with the Webflow Slider Component using Alpine.js]]></title>
            <link>https://medium.com/webflow-sprinkles/interacting-with-the-webflow-slider-component-using-alpine-js-c154885feaed?source=rss----e59e9c50165b---4</link>
            <guid isPermaLink="false">https://medium.com/p/c154885feaed</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[alpinejs]]></category>
            <category><![CDATA[webflow]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jarek Lipski]]></dc:creator>
            <pubDate>Sat, 11 Sep 2021 18:18:37 GMT</pubDate>
            <atom:updated>2022-05-29T14:07:29.955Z</atom:updated>
            <content:encoded><![CDATA[<p>A real-world example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eGHfLS0LTlXgQhkG" /><figcaption>Photo by <a href="https://unsplash.com/@philu?utm_source=medium&amp;utm_medium=referral">Philipp Lublasser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Webflow components, such as Slider, Tabs or Lightbox, are very powerful, but their internal structure can sometimes be too rigid to style them as desired. You may also need to combine multiple components together. To solve these problems, you need to write a bit of glue code. You can do this using imperative JavaScript or jQuery, but you can achieve the same effect with reactive Alpine.js code.</p><p>In my <a href="https://medium.com/@jareklipski/webflow-alpine-js-d53d77e3293">previous article,</a> we explored how to use basic Alpine.js features inside Webflow. In this one, you will develop an alternative navigation bar for the Slider component, as seen at the bottom of the picture below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*sMabzW9_76Fry4ssKO8WqA.png" /></figure><h3>TL;DR</h3><p>If you are in a rush and just want to see an example of how to interact with the Webflow component in Alpine.js, visit my demo site and check out the example on the <strong>Components</strong> page:</p><p><a href="https://alpinejs.webflow.io/components">Components</a></p><p>To see the code, visit this <a href="https://preview.webflow.com/preview/alpinejs?utm_medium=preview_link&amp;utm_source=dashboard&amp;utm_content=alpinejs&amp;preview=fa7b8979fc6916cfc44f3d7313816007&amp;workflow=preview">Read-only link</a>.</p><h3>Getting started</h3><h4>Initializing Alpine.js</h4><p>To access Alpine.js in Webflow, you can use my library:</p><p><a href="https://github.com/loomchild/webflow-alpinejs">GitHub - loomchild/webflow-alpinejs: A connector / wrapper to allow using Alpine.js in Webflow designer.</a></p><p>To initialize it, include the following script tag at the end of the &lt;body&gt; element, either globally in Project Settings or via HTML Embed on each page:</p><pre>&lt;script src=&quot;https://cdn.jsdelivr.net/npm/@loomchild/webflow-alpinejs@2/dist/index.js&quot;&gt;&lt;/script&gt;</pre><blockquote>Please refer to my article <a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">“</a><a href="https://medium.com/webflow-sprinkles/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0?source=your_stories_page-------------------------------------">How to add custom code to Webflow</a><a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">”</a> to learn more about custom code in Webflow.</blockquote><p>Next, add the HTML Embed containing the following style tag at the beginning of the &lt;body&gt; element on each page:</p><pre>&lt;link href=&quot;<a href="https://cdn.jsdelivr.net/npm/@loomchild/webflow-alpinejs@1/dist/style.css">https://cdn.jsdelivr.net/npm/@loomchild/webflow-alpinejs@2/dist/style.css</a>&quot; rel=&quot;stylesheet&quot;&gt;</pre><h4>Adding Alpine.js directives via custom attributes</h4><p>Alpine.js directives, used to add behavior to your website, are declared as custom element attributes. To add a custom attribute to an element in Webflow Designer, go to the Element Settings tab and click the plus icon on the custom attributes panel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*_fjwMkCfZS11cqGt7FP1Nw.gif" /></figure><p>In this article, custom attributes will be described as follows:</p><pre>attribute-name=&quot;attribute-value&quot;</pre><p>which corresponds to the following settings in Webflow Designer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*PBx5Gh85Saca-rFxTczoXw.png" /></figure><h3>Building the Slider navigation bar</h3><p>Now you are ready to interact with the Webflow Slider component and build an alternative navigation bar like the one on this animation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*GU86SAst6fZ_GnLj-AG2iQ.gif" /></figure><p>After completing this tutorial, you should end up with the following element structure in Webflow Designer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*wu0ikFZD9lXk0mUiRBZXQQ.png" /></figure><h4>1. Create the Slider</h4><p>Create a Slider component via the <em>Add elements</em> menu and add a few slides with image backgrounds to it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/82/1*3CugkPkuMgoL8HQdKp-cqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/166/1*Z2t_xTNKfxXtxAJvWxGCFQ.png" /></figure><p>You should see something similar to the below image in Designer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*LzErvMyxzSi6hFKipHY28w.png" /></figure><h4>2. Initialize the Alpine.js slider component</h4><p>To interact with Webflow Slider, there’s a slider component available in the webflow-alpinejs library. To initialize this component, wrap the Slider in a Slider Wrapper div block and apply the x-data directive to it:</p><pre>x-data=&quot;slider&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*5Ilc7ptX3_3frJufJz5abw.png" /></figure><h4>3. Add previous and next buttons</h4><p>Now let’s create a navigation bar with next &lt; and previous &gt; buttons:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/90/1*cvyiyaFH3sUS5tgy25fn4g.png" /></figure><p>Create the Slider Navigation Bar div block element below the Slider and inside the Slider Wrapper, and add two Slide Link elements to it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/178/1*0oAG8_-FUijl32y-XgncYg.png" /></figure><p>Apply the following x-on:click directive to &lt; button, to go back to the previous slide by calling the previousSlide function provided by the Alpine.js slider component:</p><pre>x-on:click=&quot;previousSlide&quot;</pre><p>Conversely, apply the following x-on:click directive to &gt; button, to advance to the next slide:</p><pre>x-on:click=&quot;nextSlide&quot;</pre><h4>4. Add slide selection buttons</h4><p>Finally, let’s add the buttons that will switch directly to a specific slide:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*PAexriJ3bJ50ZD6SjS3q-Q.png" /></figure><p>To avoid repetition, let’s use a loop. Create a Slide Links div block element inside the Slider Navigation Bar and add a single Slide Link element to it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/1*eE3L6OItBYvJK_EjI5TCcw.png" /></figure><p>Apply the following x-for and x-bind:key directives to Slide Links:</p><pre>x-for=&quot;(item, index) in [&#39;Winter&#39;, &#39;Spring&#39;, &#39;Summer&#39;, &#39;Autumn&#39;]&quot;<br>x-bind:key=&quot;item&quot;</pre><p>And apply the following directives to the Slide Link element inside Slide Links:</p><pre>x-text=&quot;item&quot;<br>x-on:click=&quot;slide = index&quot;<br>x-bind:class=&quot;{ active: slide === index }&quot;</pre><p>The first directive displays the current slide name, the second directive switches the slide in reaction to click, and the third directive highlights the active link.</p><p>After deployment, the page should look and work as shown in the animation at the <a href="#6b11">beginning of this chapter</a>.</p><h3>Conclusion</h3><p>As you can see, interacting with the native Webflow component in Alpine.js can be quite intuitive thanks to reusable Alpine.js components. This allows you to focus on writing clean, responsive code, without worrying about writing the code to glue the two technologies together.</p><h3>How does it work?</h3><p>If you are curious how the Alpine.js component is implemented, do not hesitate to check out the webflow-alpinejs library <a href="https://github.com/loomchild/webflow-alpinejs">source code</a>. I promise that it’s pretty straightforward, provided you know the powerful MutationObserver <a href="https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver">JavaScript API</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c154885feaed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webflow-sprinkles/interacting-with-the-webflow-slider-component-using-alpine-js-c154885feaed">Interacting with the Webflow Slider Component using Alpine.js</a> was originally published in <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Webflow + Alpine.js]]></title>
            <link>https://medium.com/webflow-sprinkles/webflow-alpine-js-d53d77e3293?source=rss----e59e9c50165b---4</link>
            <guid isPermaLink="false">https://medium.com/p/d53d77e3293</guid>
            <category><![CDATA[webflow]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[alpinejs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Jarek Lipski]]></dc:creator>
            <pubDate>Sat, 07 Aug 2021 12:01:11 GMT</pubDate>
            <atom:updated>2022-05-29T18:11:09.000Z</atom:updated>
            <content:encoded><![CDATA[<h4>A match from heaven</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F91xL_DKEmrxNfnD" /><figcaption>Photo by <a href="https://unsplash.com/@alpifree?utm_source=medium&amp;utm_medium=referral">Sylvain Mauroux</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To add interactive behavior to a <a href="https://webflow.com/">Webflow</a> site, the standard options involve writing imperative JavaScript or defining it via a point-and-click Interactions interface. Neither of these fit my personal style, so I decided to use <a href="https://alpinejs.dev/">Alpine.js</a>.</p><p>Alpine.js is a minimal JavaScript framework for composing behaviors directly in HTML markup. It offers the reactive and declarative experience of big frameworks like <a href="https://vuejs.org/">Vue</a>.js or <a href="https://reactjs.org/">React</a> but, crucially, remains much simpler than them.</p><p>The fact that Alpine.js initializes almost instantaneously and the code lives directly in element attributes, makes it a perfect fit for Webflow sites.</p><p>So, how can you use Alpine.js in Webflow?</p><h3>TL;DR</h3><p>Go straight to the solution by visiting a demo site:</p><p><a href="https://alpinejs.webflow.io/">Alpine.js Demo on Webflow</a></p><p>To see the code, visit this <a href="https://preview.webflow.com/preview/alpinejs?utm_medium=preview_link&amp;utm_source=dashboard&amp;utm_content=alpinejs&amp;preview=fa7b8979fc6916cfc44f3d7313816007&amp;workflow=preview">Read-only link</a>.</p><h3>Initializing Alpine.js</h3><p>To initialize Alpine.js in Webflow, include the following script tag at the end of the &lt;body&gt; element, either globally in Project Settings or via HTML Embed on each page:</p><pre>&lt;script src=&quot;https://cdn.jsdelivr.net/npm/@loomchild/webflow-alpinejs@3/dist/index.js&quot;&gt;&lt;/script&gt;</pre><blockquote>Please refer to my article <a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">“</a><a href="https://medium.com/webflow-sprinkles/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0?source=your_stories_page-------------------------------------">How to add custom code to Webflow</a><a href="https://jareklipski.medium.com/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">”</a> to learn more about custom code in Webflow.</blockquote><p>Next, add the HTML Embed containing the following style tag at the beginning of the &lt;body&gt; element on each page:</p><pre>&lt;link href=&quot;<a href="https://cdn.jsdelivr.net/npm/@loomchild/webflow-alpinejs@1/dist/style.css">https://cdn.jsdelivr.net/npm/@loomchild/webflow-alpinejs@3/dist/style.css</a>&quot; rel=&quot;stylesheet&quot;&gt;</pre><blockquote>Note: in addition to containing standard Alpine.js distribution, this script addresses several limitations of Alpine.js in Webflow. In particular, it allows you to create <em>&lt;template&gt;</em> elements, which are necessary for conditionals and loops, and to use directive modifiers. <a href="https://github.com/loomchild/webflow-alpinejs">See the documentation</a> to learn more.</blockquote><h3>Adding Alpine.js directives via custom attributes</h3><p>Alpine.js directives, used to add behavior to your website, are declared as custom element attributes. To add a custom attribute to an element in Webflow Designer, go to the Element Settings tab and click the plus icon on the custom attributes panel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*1t0wYO1Rx3Y755h8ieDXkg.gif" /></figure><p>In this article, custom attributes will be described as follows:</p><pre>attribute-name=&quot;attribute-value&quot;</pre><p>which corresponds to the following settings in Webflow Designer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*zSQNWNWmGSLZXhzof47Ymg.png" /></figure><h3>Alpine.js example: a dropdown menu</h3><p>In this short tutorial, you will create a simple dropdown menu using Alpine.js:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*9QnfIqW2dvDgECQgqaH23g.gif" /></figure><p>After completing the below steps, you should end up with the following structure in Webflow Designer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/138/1*hwweeLqRI4qcHNbJBRiPvg.png" /></figure><blockquote>Keep in mind that the interactive menu will be usable only on a live site, and not in Webflow Designer or Preview.</blockquote><h4>1. Initialize the dropdown menu component</h4><p>Create a div block element representing the dropdown menu component and initialize it in closed state by applying the following <a href="https://alpinejs.dev/directives/data">x-data</a> directive to this element:</p><pre>x-data=&quot;{ open: false }&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*UNJNphi_Qrea-LoJKUg3LA.png" /></figure><h4>2. Define the dropdown menu content</h4><p>Create a Menu Content div block element inside the dropdown menu component. Set its Position to Absolute, with a solid background color.</p><p>Next, create three link elements.</p><p>Finally, show the menu content only if the open variable is true, by applying the following <a href="https://alpinejs.dev/directives/show">x-show</a> directive to the Menu Content element:</p><pre>x-show=&quot;open&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/154/1*nuVSnX3IVJYkEl4hhHHScw.png" /></figure><h4>3. Open the menu with x-on:click event listener</h4><p>Create a Button element inside the div block that will open the dropdown menu. Add the <a href="https://alpinejs.dev/directives/on">x-on:click</a> directive to attach a mouse click event listener to the button, that will update the open variable:</p><pre>x-on:click=&quot;open = true&quot;</pre><blockquote>Note that in Webflow you need to use a full directive name <em>x-on:click</em>, instead of a <em>@click</em> shorthand.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*NijJDogzBEGg6b5V31ypyw.png" /></figure><h4>4. Close the menu with .outside modifier</h4><p>To close the dropdown menu, apply the following x-on:click directive with the <a href="https://alpinejs.dev/directives/on#outside">.outside</a> modifier to the Menu Content element:</p><pre>x-on:click:outside=&quot;open = false&quot;</pre><blockquote>Note that in Webflow the dot . character used in modifiers needs to be replaced by the colon : character.</blockquote><h4>5. Hide the menu before framework initialization via x-cloak</h4><p>You might notice that when loading the page, the hidden menu content is displayed for a brief moment, creating an ugly flickering effect. To hide an element until Alpine.js is fully initialized, apply the following <a href="https://alpinejs.dev/directives/cloak">x-cloak</a> directive to the Menu Content element:</p><pre>x-cloak=&quot;1&quot;</pre><blockquote>It doesn’t matter what value you set for this binary attribute.</blockquote><p>If you want to display a hidden element in Webflow Designer to make changes to it, add a uncloak class to this element (it will remain hidden on the live site):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*X_sG6w7FyIPiuj2SluAMuQ.png" /></figure><h4>Bonus: display menu items with a x-for loop</h4><p>If you want to avoid repeating the menu links or if the link list is dynamic, you can use a loop directive.</p><p>First, create a div block element inside the Menu Content element and apply the following <a href="https://alpinejs.dev/directives/for">x-for</a> directive to it:</p><pre>x-for=&quot;link in [{ label: &#39;One&#39;, url: &#39;/one&#39; }, { label: &#39;Two&#39;, url: &#39;/two&#39; }, { label: &#39;Three&#39;, url: &#39;/three&#39; }]&quot;</pre><p>Next, create a link element inside the div block, and apply the following <a href="https://alpinejs.dev/directives/text">x-text</a> and <a href="https://alpinejs.dev/directives/bind">x-bind</a> directives to it:</p><pre>x-text=&quot;link.label&quot;<br>x-bind:href=&quot;link.url&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*dF51FZmcID-rRhTmjoV11g.png" /></figure><p>Similarly, the middle link can be conditionally omitted by wrapping the link element in a div block element containing the following <a href="https://alpinejs.dev/directives/if">x-if</a> directive:</p><pre>x-if=&quot;link.label !== &#39;Two&#39;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*JMbHdqfYKDnbimGP7bciCA.png" /></figure><blockquote>Note that in standard Alpine.js you’d use a <em>&lt;template&gt;</em> element instead of a div block <em>&lt;div&gt;</em> element. However, since Webflow doesn’t allow creating <em>&lt;template&gt;</em> elements directly, all elements containing the <em>x-for</em> or <em>x-if</em> custom attribute will be automatically wrapped in <em>&lt;template&gt;</em> elements.</blockquote><h3>Conclusion</h3><p>There you have it — Alpine.js in Webflow!</p><p>I have created a simple demo site to illustrate this article. To see it in action visit <a href="https://alpinejs.webflow.io/">the demo page</a> and to examine the code follow <a href="https://preview.webflow.com/preview/alpinejs?utm_medium=preview_link&amp;utm_source=showcase&amp;utm_content=alpinejs&amp;preview=fa7b8979fc6916cfc44f3d7313816007">the preview link</a>.</p><p>This is just the beginning —please see my follow-up article on how to interact with built-in Webflow Slider component via Alpine.js:</p><p><a href="https://medium.com/untitled-factory/interacting-with-the-webflow-slider-component-using-alpine-js-c154885feaed">Interacting with the Webflow Slider Component using Alpine.js</a></p><p><em>Edit: this article was updated for Alpine.js 3, released June 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d53d77e3293" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webflow-sprinkles/webflow-alpine-js-d53d77e3293">Webflow + Alpine.js</a> was originally published in <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add custom code to Webflow]]></title>
            <link>https://medium.com/webflow-sprinkles/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0?source=rss----e59e9c50165b---4</link>
            <guid isPermaLink="false">https://medium.com/p/85da0f13ebe0</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[webflow]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Jarek Lipski]]></dc:creator>
            <pubDate>Sun, 04 Jul 2021 14:17:19 GMT</pubDate>
            <atom:updated>2022-02-18T20:53:40.388Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l4VyzIQoaVDZWIKV" /><figcaption>Photo by <a href="https://unsplash.com/@sharonmccutcheon?utm_source=medium&amp;utm_medium=referral">Sharon McCutcheon</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Webflow empowers designers to build custom websites without writing any code. However, custom code is helpful in adding that extra layer of polish to your website. Tiny code sprinkles can make the difference between a good and exceptional site. If you keep the custom code to the minimum and follow the best practices, then the benefits clearly outweigh the risks.</p><blockquote>Note that using custom code in Webflow requires a paid account or a paid site plan.</blockquote><h3>What is custom code in Webflow?</h3><p>Custom code can be any element, style or behavior not supported natively by the Webflow visual development environment.</p><p>Types of custom code available in Webflow include:</p><ol><li>HTML (HyperText Markup Language) — representing the content structure of your website, such as paragraphs, images, links, sections, etc.</li><li>CSS (Cascading Style Sheets) — defining how the website will look, such as colors, spacing, fonts, backgrounds, layout, etc.</li><li>JavaScript — controlling your website behavior, such as opening a pop-up window, modifying content or style responding to user action, validating a contact form, retrieving data from the server, etc.</li></ol><h3>How to add custom code in Webflow?</h3><h4>1. Via Project Settings</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*gkkBK-jtKl-ECDPSK22sgA.gif" /><figcaption>Edit Project Settings</figcaption></figure><p>You can access Project Settings by the top-left hamburger menu. Next, navigate to the Custom Code tab.</p><p>Project Settings offer two slots for your custom code — at the end of the &lt;head&gt; element and at the end of the &lt;body&gt; element:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ya5DtpyT3Brv7nfP9CwNYA.png" /><figcaption>Custom code slots in Project Settings</figcaption></figure><p>Custom code added to Project Settings will be added on every page of your site. It’s the most efficient way to load your code and sometimes also the most convenient.</p><blockquote>Note that you need to publish your site to see the effects of the custom code added via Project Settings.</blockquote><h4>2. Via Page Settings</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*c--PLreWAmnimdnCWMUl2A.gif" /><figcaption>Edit Page Settings</figcaption></figure><p>You can access the Page Settings by clicking the cog icon of a selected page. Next, scroll to the Custom Code section towards the bottom of the settings panel.</p><p>Page Settings offer the same &lt;head&gt; and &lt;body&gt; slots as the Project Settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*Q8b3yJOFsZ14pa7FVNKfYw.png" /><figcaption>Custom code slots in Page Settings</figcaption></figure><p>Custom code added to Page Settings will affect only a single page of your website.</p><blockquote>You need to publish your site to see the effects of the custom code added via Page Settings.</blockquote><h4>3. As HTML Embed</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*1wvcvgveZNrz3m--jaKrzg.gif" /><figcaption>HTML Embed, accessible via the Add menu</figcaption></figure><p>You can find the HTML Embed element at the bottom of the Add panel.</p><p>Using HTML Embed gives you full control at which location the custom code will be added.</p><blockquote>You don’t need to publish your site — custom HTML and CSS added as HTML Embed will be immediately visible in the Designer! You still need to publish your site to see the effects of custom JavaScript though.</blockquote><blockquote>Tip: To avoid repetition, place your HTML Embed inside a Symbol and reuse it across pages.</blockquote><h3>Where to put each custom code type?</h3><h4>1. HTML</h4><p>Using custom HTML you can integrate with a 3rd-party service, such as a map, social feed or survey.</p><blockquote>Note that such integration sometimes requires combining a bit of HTML, CSS and JavaScript together</blockquote><p>HTML code should be added as HTML Embed.</p><h4>2. CSS</h4><p>Custom CSS allows you to add styles to your website that are not officially supported by Webflow, such as a blurred transparent background, truncating multiple line text with an ellipsis, etc.</p><p>It also gives you access to advanced selectors, e.g. targeting all odd children of an element to add a zebra stripe to a table (find more info about <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors">CSS Selectors on MDN</a>).</p><p>Finally, custom CSS can be used to fix layout issues for a specific web browser or make your website usable on a legacy one.</p><p>I like to add CSS code as HTML Embed to see the results in Designer. Ideally, it should be the first element on a page.</p><blockquote>Note that putting CSS inside HTML Embed is technically against web standards, but web browsers are happy with it (<a href="https://stackoverflow.com/a/50154225/4619705">more info</a>).</blockquote><p>Alternatively, If you don’t need to see the preview in Designer, you can put your CSS in the Project Settings &lt;head&gt; slot.</p><p>Finally, remember to always wrap your CSS code inside an &lt;style&gt; element:</p><pre>&lt;style&gt;<br>  ... your CSS ...<br>&lt;/style&gt;</pre><h4>3. JavaScript</h4><p>Custom JavaScript could give your website almost unlimited functionality, for example redirecting the visitor to a regional version of the site based on their location, phone number formatting and validation on a contact form, integrating with external CRM software, etc.</p><p>The default place for your custom JavaScript is at the end of the Project Settings &lt;body&gt; slot.</p><blockquote>This means that your code will be placed at the bottom of each page, which allows it to refer to &amp; affect any element on the page. In addition to that, JavaScript will be executed last, which avoids slowing down the loading of your site.</blockquote><p>Sometimes you might want your JavaScript to be executed before the page is displayed, e.g. initializing analytics. In such cases, put the code in the Project Settings &lt;head&gt; slot.</p><p>Finally, remember to always wrap your JavaScript code inside an &lt;script&gt; element:</p><pre>&lt;script&gt;<br>  ... your JavaScript ...<br>&lt;/script&gt;</pre><p>Thanks for reading, I hope you enjoyed it! For more Webflow coding tips for designers, please follow <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles publication</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85da0f13ebe0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webflow-sprinkles/you-dont-have-to-be-a-developer-to-add-custom-code-to-webflow-85da0f13ebe0">How to add custom code to Webflow</a> was originally published in <a href="https://medium.com/webflow-sprinkles">Webflow Sprinkles</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>