Like any other SPA framework, Svelte allows us to show parts of HTML or components conditionally. If we compare it with React, in React we return a fragment/component for each…
How to bind CSS classes conditionally in Svelte | Example
More often than not, we'd need to bind CSS class names conditionally. One of the prime examples is form validation. We often like to highlight to show erroneous messages in…
How to parse and output HTML in Svelte | Example
By default, if we try to input some HTML value in a text input or a textarea input and display it directly, it won't parse it as HTML. That is,…
How to pass props to components in Svelte | Example
Earlier we saw how we can import one component into another in Svelte. But this is not of much use if we cannot pass some values to the components we…
How to import one component inside another in Svelte | Example
Svelte has probably one of the most compact syntaxes to import components. All other SPA frameworks seem to demand more code lines. Let's have a look at an example. In…
How to do two-way data binding in Svelte | Example
In the previous example, we learned how we can do two-way data binding in Svelte by using the :on event listener. However, it required us two steps to bind a…
How to auto-lowercase user input in Svelte | Example
In the previous article, we saw how we can use reactive declaration $ in Svelte. In this article, we'll have a look at how we can automatically lowercase the user…
How to use reactive declaration $ in Svelte | Example
Reactive Declarations are some of the most powerful features in Svelte. If you've worked with Vue.js, it's somewhat similar to how computed properties work. Let's have a look at this…
How to create a timeline quickly in Vue.js | Example
Timelines can be created with pure HTML and CSS. However, it often takes a lot of time to design it from scratch. If you want to get it done quickly,…