Learn how to configure FlyonUI in a Svelte project, integrating Tailwind CSS for enhanced and customizable styling.
Installation
Please note that this plugin has been tested with the latest framework version (v5.0.5). It was installed using the standard `npx sv create my-app` command. If you’re working with a custom project setup or a different framework version, be sure to check the file paths and features specific to your version!
Quick Svelte setup
Svelte is a powerful JavaScript framework designed for building fast, efficient web applications. If you haven't configured Tailwind CSS yet, refer to the SvelteKit Tailwind CSS installation guide.
Add the FlyonUI Hook projects_root_directory/src/ hooks.client.ts file.
import"./lib/client/init";
5
Add a reinitialization helper
Insert the code that reinitializes components whenever to ensure that FlyonUI.js is reinitialized after any DOM updates and navigation events changes in projects_root_directory/src/routes/+layout.svelte.
<script> import { afterNavigate } from"$app/navigation"; afterNavigate(() => { // Runs after navigating between pages HSStaticMethods.autoInit(); }); </script>
Passing parameters using data attributes. Observe how the object containing the parameters is wrapped in curly braces and how the slashes are properly escaped.