Flowbite
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/flowbite3-theme@nextyarn add @sjsf/flowbite3-theme@nextpnpm add @sjsf/flowbite3-theme@nextbun add @sjsf/flowbite3-theme@nextflowbite-svelte ^1.19.0 is required.
Install Flowbite Svelte v3
Section titled “Install Flowbite Svelte v3”Quickstart - Flowbite Svelte
Configuration
Section titled “Configuration”Register the theme source path by adding the following line to the app.css file:.
@source "../node_modules/@sjsf/flowbite3-theme/dist";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/flowbite3-theme/extra-widgets/checkboxes-include"import "@sjsf/flowbite3-theme/extra-widgets/date-picker-include"// Used by default in the following fields: fileField, filesFieldimport "@sjsf/flowbite3-theme/extra-widgets/file-include"import "@sjsf/flowbite3-theme/extra-widgets/multi-select-include"import "@sjsf/flowbite3-theme/extra-widgets/radio-buttons-include"import "@sjsf/flowbite3-theme/extra-widgets/radio-include"import "@sjsf/flowbite3-theme/extra-widgets/range-include"import "@sjsf/flowbite3-theme/extra-widgets/switch-include"// Used by default in the following fields: tagsFieldimport "@sjsf/flowbite3-theme/extra-widgets/tags-include"import "@sjsf/flowbite3-theme/extra-widgets/textarea-include"import "@sjsf/flowbite3-theme/extra-widgets/toggle-radio-buttons-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 } } }, "radioButtons": { "type": "object", "properties": { "default": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "error": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] } } }, "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" } } }, "tags": { "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 } } }, "textarea": { "type": "object", "properties": { "default": { "type": "string" }, "error": { "type": "string" } } }, "toggleRadioButtons": { "type": "object", "properties": { "default": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] }, "error": { "type": "string", "enum": [ "foo", "bar", "fuzz", "qux" ] } } } }}{ "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": { "flowbite3Datepicker": { "locale": "en-US" }, "title": "datePicker" } }, "error": { "ui:components": { "textWidget": "datePickerWidget" }, "ui:options": { "flowbite3Datepicker": { "locale": "en-US" }, "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": { "useLabel": false, "title": "multiSelect" } }, "error": { "ui:components": { "arrayField": "multiEnumField", "checkboxesWidget": "multiSelectWidget" }, "ui:options": { "useLabel": false, "title": "multiSelect" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }, "radioButtons": { "default": { "ui:components": { "stringField": "enumField", "selectWidget": "radioButtonsWidget" }, "ui:options": { "useLabel": false, "title": "radioButtons" } }, "error": { "ui:components": { "stringField": "enumField", "selectWidget": "radioButtonsWidget" }, "ui:options": { "useLabel": false, "title": "radioButtons" } }, "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": { "useLabel": false, "title": "radio" } }, "error": { "ui:components": { "stringField": "enumField", "selectWidget": "radioWidget" }, "ui:options": { "useLabel": false, "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;" } } } }, "tags": { "default": { "ui:components": { "arrayField": "arrayTagsField" }, "ui:options": { "title": "tags" } }, "error": { "ui:components": { "arrayField": "arrayTagsField" }, "ui:options": { "title": "tags" } }, "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;" } } } }, "toggleRadioButtons": { "default": { "ui:components": { "stringField": "enumField", "selectWidget": "flowbite3ToggleRadioButtonsWidget" }, "ui:options": { "useLabel": false, "title": "toggleRadioButtons" } }, "error": { "ui:components": { "stringField": "enumField", "selectWidget": "flowbite3ToggleRadioButtonsWidget" }, "ui:options": { "useLabel": false, "title": "toggleRadioButtons" } }, "ui:options": { "layouts": { "object-properties": { "style": "display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;" } } } }}Supported validation events
Section titled “Supported validation events”| checkbox | oninput, onchange, onblur |
| checkboxes | oninput, onchange, onblur |
| file | onchange, onblur |
| multiFile | onchange, onblur |
| number | oninput, onchange, onblur |
| select | oninput, onchange, onblur |
| text | oninput, onchange, onblur |
| datePicker | oninput, onchange, onblur |
| multiSelect | oninput, onchange, onblur |
| radioButtons | oninput, onchange, onblur |
| radio | oninput, onchange, onblur |
| range | oninput, onchange, onblur |
| switch | oninput, onchange, onblur |
| tags | oninput, onchange, onblur |
| textarea | oninput, onchange, onblur |
| toggleRadioButtons | onchange |
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 { ButtonGroupProps, ButtonProps as ButtonPropsUnion, ButtonToggleGroupProps, ButtonToggleProps, CheckboxProps, DatepickerProps, FileuploadProps, HelperProps, InputProps, LabelProps, MultiSelectProps, RadioButtonProps, RadioProps, RangeProps, SelectProps, TagsProps, TextareaProps, ToggleProps,} from "flowbite-svelte";
type ButtonProps = Extract< ButtonPropsUnion, { type?: HTMLButtonAttributes["type"] }>;
export interface UiOptions { flowbite3Button?: ButtonProps; flowbite3Buttons?: { [B in ButtonType]?: ButtonProps; }; /** * Overrides the attributes of the description. */ descriptionAttributes?: HTMLAttributes<HTMLDivElement>; /** * Overrides the attributes of the errors list. */ errorsList?: HTMLAttributes<HTMLUListElement>;
form?: HTMLFormAttributes;
flowbite3Help?: HelperProps;
flowbite3Label?: LabelProps; /** * Overrides the attributes of any layout component. */ layout?: HTMLAttributes<HTMLDivElement>; /** * Overrides the attributes of a layout with a specific type. * This override takes precedence over the `layout` override, but does not replace it. */ layouts?: { [L in LayoutType]?: HTMLAttributes<HTMLDivElement>; }; flowbite3ButtonGroup?: ButtonGroupProps;
flowbite3SubmitButton?: ButtonProps; /** * Overrides the attributes of the field title */ titleAttributes?: HTMLAttributes<HTMLDivElement>;
flowbite3Checkbox?: CheckboxProps;
flowbite3Number?: InputProps<number | undefined>;
flowbite3Select?: SelectProps<number>;
flowbite3Text?: InputProps<string | undefined>;
flowbite3Checkboxes?: CheckboxProps;
flowbite3Datepicker?: DatepickerProps;
flowbite3File?: FileuploadProps;
flowbite3MultiSelect?: Omit<MultiSelectProps<number>, "value">;
flowbite3RadioButtons?: Omit<ButtonGroupProps, "children">; flowbite3RadioButtonsItem?: Partial<RadioButtonProps<string>>;
flowbite3Radio?: RadioProps<number>;
flowbite3Range?: RangeProps;
flowbite3Switch?: ToggleProps;
flowbite3Tags?: Omit<TagsProps, "value">;
flowbite3Textarea?: TextareaProps;
flowbite3ToggleRadioButtons?: Omit<ButtonToggleGroupProps, "children">; flowbite3ToggleRadioButtonsItem?: Partial<ButtonToggleProps>;}