Skip to content
Playground

Flowbite

Installation

Terminal window
npm i @sjsf/flowbite-theme

Install Flowbite Svelte

Quickstart - Flowbite Svelte

Setup styles

There is two ways to setup styles:

  1. Tailwind configuration
import flowbite from 'flowbite/plugin';
import { THEME_CONTENT, FLOWBITE_CONTENT } from '@sjsf/flowbite-theme/preset'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,js,svelte,ts}', THEME_CONTENT, FLOWBITE_CONTENT],
plugins: [flowbite],
}
  1. Inject prepared styles (not recommended)
// Inject them as you like
import flowbiteStyles from "@sjsf/flowbite-theme/styles.css?inline";

Additional widgets

  • toggle

Demo

<script lang="ts">
import { SimpleForm } from "@sjsf/form";
import { theme } from "@sjsf/flowbite-theme";
import { useAstro } from "@/astro.svelte";
import { useCustomForm } from "@/components/custom-form";
import { schema, uiSchema } from "./_demo-schema";
const astro = useAstro();
const form = useCustomForm({
...theme,
schema,
uiSchema,
});
</script>
<SimpleForm
{form}
novalidate
class="flex flex-col gap-4 mb-4 {astro.darkOrLight}"
/>
<pre>{JSON.stringify(form.value, null, 2)}</pre>