Svelte - Introduction
Get started with the most popular open-source library of interactive UI components built with the utility classes from Tailwind CSS
Introduction #
Svelte is a JavaScript framework that’s used to build static web applications. It’s similar to other JavaScript frameworks like React, Angular, Vue, and Ractive. Svelte is ideal for building applications that require speed. It generates highly optimized code through its compilation step.
Svelte excels at building single, reusable components for any project. It’s popular because it allows developers to build web applications in a declarative style. This can make it easier to understand and develop applications, especially for developers who are familiar with these types of frameworks.
Svelte’s advantages include: #
- Highly optimized code
- Lightweight applications
- Interactive applications
- Reduced size of transferred files
- Better client performance
- Everything is written in native HTML, CSS, and JavaScript
To use Svelte, you need a terminal with node + npm installed.
Here’s a quick overview of the ecosystem including the open source Tailwind components library, the Figma design files, and the pro version.
Quickstart
Learn how to get started by downloading and configuring Flowbite locally on your machine and start developing.
Components
Explore the Tailwind CSS elements such as buttons, navbars, alerts, dropdowns and use them to build your website.
Figma design files
Prototype and design your website before coding with the Flowbite Figma file which is based on the Tailwind CSS classes.
Upgrade to Pro
Take your Figma and Tailwind CSS development to the next level with thousands more elements and pages with Flowbite Pro.
Using Flowbite #
One of the disadvantages of Tailwind CSS compared to other frameworks is that it doesn’t have a base set of components. This makes it really hard to quickly prototype a user interface.
This is where Flowbite comes into play: it’s basically Tailwind CSS, but you get all of the components that you would normally get with a classic CSS framework like Bootstrap or Bulma.
There are 52 types of UI components including buttons, alerts, breadcrumbs, pagination, and navbars. Flowbite also includes some custom JavaScript that enables interactive components, such as dropdowns, modals, tooltips, and many more.
Getting started #
Flowbite is technically a plugin that can be included into any existing Tailwind CSS project. To get started, you first need to make sure that you have a working Tailwind CSS project installed and that you also have Node and NPM installed on your machine.
Require via NPM #
- Install the latest version of Flowbite using NPM:
npm i flowbite
- Include Flowbite as a plugin inside the
tailwind.config.js
file:
module.exports = {
plugins: [require("flowbite/plugin")],
};
- Require the JavaScript code that powers the interactive elements before the end of your
<body>
tag:
<script src="../path/to/flowbite/dist/flowbite.js"></script>
- Additionally to your own
content
data you should addflowbite
to apply the classes from the interactive elements in thetailwind.config.js
file:
module.exports = {
content: ["./node_modules/flowbite/**/*.js"],
};
If you use Webpack or other bundlers you can also import it like this:
import "flowbite";
Include via CDN #
If you want to quickly test out Flowbite you can easily include the following CSS and JavaScript files.
Require the following minified stylesheet inside the head
tag:
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/flowbite.min.css"
/>
And include the following javascript file before the end of the body
element:
<script src="https://unpkg.com/[email protected]/dist/flowbite.js"></script>
Please remember that the best way to work with Tailwind CSS and Flowbite is by purging the CSS classes.
Tailwind CSS 2.0 #
Flowbite is fully compatible with the 2.x versions of Tailwind CSS.
Tailwind CSS 3.0 #
Feel free to upgrade to version 3 of Tailwind CSS as there are no breaking changes when using the components from Flowbite.
Figma #
The components from Flowbite are first conceptualized and designed in Figma using the latest features such as variants, auto-layout, grids, responsive layouts, and more.
Learn more by checking out Flowbite’s Figma design system and start designing your Tailwind CSS projects before actually coding them.
Next.js #
If you’re using React as a front-end library and Next.js as a framework you can also use the components from Flowbite React such as the modals, dropdowns, and navbars to speed up your development time coupled with the utility classes from Tailwind CSS.
Learn how to install Tailwind CSS and Flowbite with Next.js and React.