Flowbite tw3
Flowbite™ is a registered trademark of Bergside Inc. This website is not affiliated with, endorsed by, or sponsored by Bergside Inc. All rights to the trademark are owned by Bergside Inc.
Installation
Section titled “Installation”npm i @sjsf/flowbite-theme@nextyarn add @sjsf/flowbite-theme@nextpnpm add @sjsf/flowbite-theme@nextbun add @sjsf/flowbite-theme@nextflowbite-svelte ~0.47.0 is required.
Install Flowbite Svelte
Section titled “Install Flowbite Svelte”Quickstart - Flowbite Svelte
Setup styles
Section titled “Setup styles”There is two ways to setup styles:
- 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],}- Inject prepared styles (not recommended)
// Inject them as you likeimport flowbiteStyles from "@sjsf/flowbite-theme/styles.css?inline";Extra widgets
Section titled “Extra widgets”You can connect extra widgets using the following include imports:
// Used by default in the following fields: multiEnumFieldimport "@sjsf/flowbite-theme/extra-widgets/checkboxes-include"import "@sjsf/flowbite-theme/extra-widgets/date-picker-include"// Used by default in the following fields: fileField, filesFieldimport "@sjsf/flowbite-theme/extra-widgets/file-include"import "@sjsf/flowbite-theme/extra-widgets/multi-select-include"import "@sjsf/flowbite-theme/extra-widgets/radio-include"import "@sjsf/flowbite-theme/extra-widgets/range-include"import "@sjsf/flowbite-theme/extra-widgets/switch-include"import "@sjsf/flowbite-theme/extra-widgets/textarea-include"Widgets demo
Section titled “Widgets demo”{ "type": "object", "properties": { "checkbox": { "type": "object", "properties": { "default": { "type": "boolean" }, "error": { "type": "boolean" } } }, "checkboxes": { "type": "object", "properties": { "default": { "type": "array", "items": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "uniqueItems": true }, "error": { "type": "array", "items": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "uniqueItems": true } } }, "file": { "type": "object", "properties": { "default": { "type": "string", "format": "data-url" }, "error": { "type": "string", "format": "data-url" } } }, "multiFile": { "type": "object", "properties": { "default": { "type": "array", "items": { "type": "string", "format": "data-url" } }, "error": { "type": "array", "items": { "type": "string", "format": "data-url" } } } }, "number": { "type": "object", "properties": { "default": { "type": "number" }, "error": { "type": "number" } } }, "select": { "type": "object", "properties": { "default": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "error": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] } } }, "text": { "type": "object", "properties": { "default": { "type": "string" }, "error": { "type": "string" } } }, "datePicker": { "type": "object", "properties": { "default": { "type": "string" }, "error": { "type": "string" } } }, "multiSelect": { "type": "object", "properties": { "default": { "type": "array", "items": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "uniqueItems": true }, "error": { "type": "array", "items": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "uniqueItems": true } } }, "radio": { "type": "object", "properties": { "default": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "error": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] } } }, "range": { "type": "object", "properties": { "default": { "type": "number" }, "error": { "type": "number" } } }, "switch": { "type": "object", "properties": { "default": { "type": "boolean" }, "error": { "type": "boolean" } } }, "textarea": { "type": "object", "properties": { "default": { "type": "string" }, "error": { "type": "string" } } } }}{ "checkbox": { "default": { "ui:options": { "title": "checkbox" } }, "error": { "ui:options": { "title": "checkbox" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "checkboxes": { "default": { "ui:components": { "arrayField": "multiEnumField" }, "ui:options": { "title": "checkboxes" } }, "error": { "ui:components": { "arrayField": "multiEnumField" }, "ui:options": { "title": "checkboxes" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "file": { "default": { "ui:components": { "stringField": "fileField" }, "ui:options": { "title": "file" } }, "error": { "ui:components": { "stringField": "fileField" }, "ui:options": { "title": "file" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "multiFile": { "default": { "ui:components": { "arrayField": "arrayFilesField" }, "ui:options": { "title": "multiFile" } }, "error": { "ui:components": { "arrayField": "arrayFilesField" }, "ui:options": { "title": "multiFile" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "number": { "default": { "ui:options": { "title": "number" } }, "error": { "ui:options": { "title": "number" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "select": { "default": { "ui:components": { "stringField": "enumField" }, "ui:options": { "title": "select" } }, "error": { "ui:components": { "stringField": "enumField" }, "ui:options": { "title": "select" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "text": { "default": { "ui:options": { "title": "text" } }, "error": { "ui:options": { "title": "text" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "datePicker": { "default": { "ui:components": { "textWidget": "datePickerWidget" }, "ui:options": { "title": "datePicker" } }, "error": { "ui:components": { "textWidget": "datePickerWidget" }, "ui:options": { "title": "datePicker" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "multiSelect": { "default": { "ui:components": { "arrayField": "multiEnumField", "checkboxesWidget": "multiSelectWidget" }, "ui:options": { "title": "multiSelect" } }, "error": { "ui:components": { "arrayField": "multiEnumField", "checkboxesWidget": "multiSelectWidget" }, "ui:options": { "title": "multiSelect" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "radio": { "default": { "ui:components": { "stringField": "enumField", "selectWidget": "radioWidget" }, "ui:options": { "title": "radio" } }, "error": { "ui:components": { "stringField": "enumField", "selectWidget": "radioWidget" }, "ui:options": { "title": "radio" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "range": { "default": { "ui:components": { "numberWidget": "rangeWidget" }, "ui:options": { "title": "range" } }, "error": { "ui:components": { "numberWidget": "rangeWidget" }, "ui:options": { "title": "range" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "switch": { "default": { "ui:components": { "checkboxWidget": "switchWidget" }, "ui:options": { "title": "switch" } }, "error": { "ui:components": { "checkboxWidget": "switchWidget" }, "ui:options": { "title": "switch" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "textarea": { "default": { "ui:components": { "textWidget": "textareaWidget" }, "ui:options": { "title": "textarea" } }, "error": { "ui:components": { "textWidget": "textareaWidget" }, "ui:options": { "title": "textarea" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }}UI options
Section titled “UI options”import type { HTMLAttributes, HTMLButtonAttributes, HTMLFormAttributes,} from "svelte/elements";import type { ButtonType, LayoutType } from "@sjsf/form/fields/exports";import type { ButtonProps as ButtonPropsUnion } from "flowbite-svelte2/Button.svelte";import type { HelperProps } from "flowbite-svelte2/Helper.svelte";import type { LabelProps } from "flowbite-svelte2/Label.svelte";import type { ButtonGroupProps } from "flowbite-svelte2/ButtonGroup.svelte";import type { CheckboxProps } from "flowbite-svelte2/Checkbox.svelte";import type { NumberInputProps } from "flowbite-svelte2/NumberInput.svelte";import type { SelectProps } from "flowbite-svelte2/Select.svelte";import type { InputProps } from "flowbite-svelte2/Input.svelte";import type { DatepickerProps } from "flowbite-svelte2/Datepicker.svelte";import type { FileuploadProps } from "flowbite-svelte2/Fileupload.svelte";import type { MultiSelectProps } from "flowbite-svelte2/MultiSelect.svelte";import type { RadioProps } from "flowbite-svelte2/Radio.svelte";import type { RangeProps } from "flowbite-svelte2/Range.svelte";import type { ToggleProps } from "flowbite-svelte2/Toggle.svelte";import type { TextareaProps } from "flowbite-svelte2/Textarea.svelte";
type ButtonProps = Extract< ButtonPropsUnion, { type?: HTMLButtonAttributes["type"] }>;
export interface UiOptions { flowbiteButton?: ButtonProps; flowbiteButtons?: { [B in ButtonType]?: ButtonProps; };
flowbiteDescription?: HTMLAttributes<HTMLDivElement>;
flowbiteErrorsList?: HTMLAttributes<HTMLUListElement>;
flowbiteForm?: HTMLFormAttributes;
flowbiteHelp?: HelperProps;
flowbiteLabel?: LabelProps;
flowbiteLayout?: HTMLAttributes<HTMLDivElement>; flowbiteLayouts?: { [L in LayoutType]?: HTMLAttributes<HTMLDivElement>; }; flowbiteButtonGroup?: ButtonGroupProps;
flowbiteSubmitButton?: ButtonProps;
flowbiteTitle?: HTMLAttributes<HTMLParagraphElement>;
flowbiteCheckbox?: CheckboxProps;
flowbiteNumber?: NumberInputProps;
flowbiteSelect?: SelectProps;
flowbiteText?: InputProps;
flowbiteCheckboxes?: CheckboxProps;
flowbiteDatepicker?: DatepickerProps;
flowbiteFile?: FileuploadProps;
flowbiteMultiSelect?: MultiSelectProps;
flowbiteRadio?: RadioProps;
flowbiteRange?: RangeProps;
flowbiteSwitch?: ToggleProps;
flowbiteTextarea?: TextareaProps;}