Set up FlyonUI with SolidJS using Tailwind CSS Integrate FlyonUI with SolidJS and Tailwind CSS to create a modern, responsive UI, simplifying your development workflow with ease.
Installation Please note that the plugin has been tested with the latest version of the framework (v1.9.0). The framework was installed using the standard `npm create vite@latest project-name -- --template solid`
command.
If you are using your own project structure, be mindful of file paths!
Quick
SolidJS
setup A tool for building simple, performant, and reactive user interfaces. If you haven't set up Tailwind CSS yet, check out
SolidJS Tailwind CSS
installation guides.
1
Install FlyonUI
Install
flyonui
via npm.
2
Configure FlyonUI JavaScript paths
Add the path to FlyonUI JavaScript files in your tailwind.config.js
file.
// tailwind.config.js
module .exports = {
content : [
'./node_modules/flyonui/dist/js/*.js' ,
],
plugins : [
require ('flyonui' ),
require ('flyonui/plugin' )
],
};
Note: If you want to include specific js component
Tip : Using specific components helps minimize the size of the generated JavaScript and CSS.
// tailwind.config.js
module .exports = {
content : [
'./node_modules/flyonui/dist/js/accordion.js' , // Specific JS component
]
...
};
3
Add the FlyonUI JavaScript
Add the FlyonUI JavaScript in your app entry point root_directory/src/index.tsx
import { render } from "solid-js/web" ;
import { Router } from "@solidjs/router" ;
...
import "flyonui/flyonui" ;
4
Add a reinitialization helper
Add code to reinitialize the components each time the app is mounted or when the page changes in root_directory/src/App.tsx
.
import { createSignal , createEffect } from "solid-js" ;
import { useLocation } from "@solidjs/router" ;
import { IStaticMethods } from "flyonui/flyonui" ;
declare global {
interface Window {
HSStaticMethods : IStaticMethods ;
}
}
...
const App = () => {
const location = useLocation ();
const [_ , setLoc ] = createSignal (location .pathname );
createEffect (() => {
setLoc (location .pathname );
window.HSStaticMethods .autoInit ();
});
return (
...
);
};
export default App ;
Note: If you want to include specific js component
...
import { type HSAccordion } from 'flyonui/flyonui' ;
declare global {
interface Window {
HSAccordion : typeof HSAccordion ;
}
}
...
const App = () => {
const location = useLocation ();
const [_ , setLoc ] = createSignal (location .pathname );
createEffect (() => {
setLoc (location .pathname );
window.HSAccordion .autoInit ();
});
return (
...
);
};
export default App ;