Skip to content
Playground

daisyUI

Terminal window
npm i @sjsf/daisyui5-theme

daisyUI ^5.0.0 is required.

Install daisyUI as a Tailwind plugin

Register the theme source path by adding the following line to the app.css file:.

@source "../node_modules/@sjsf/daisyui5-theme/dist";

You can connect extra widgets using the following include imports:

import "@sjsf/daisyui5-theme/extra-widgets/cally-date-picker-include"
// Used by default in the following fields: multiEnumField
import "@sjsf/daisyui5-theme/extra-widgets/checkboxes-include"
// Used by default in the following fields: fileField, filesField
import "@sjsf/daisyui5-theme/extra-widgets/file-include"
import "@sjsf/daisyui5-theme/extra-widgets/filter-radio-buttons-include"
import "@sjsf/daisyui5-theme/extra-widgets/multi-select-include"
import "@sjsf/daisyui5-theme/extra-widgets/pikaday-date-picker-include"
import "@sjsf/daisyui5-theme/extra-widgets/radio-buttons-include"
import "@sjsf/daisyui5-theme/extra-widgets/radio-include"
import "@sjsf/daisyui5-theme/extra-widgets/range-include"
import "@sjsf/daisyui5-theme/extra-widgets/rating-include"
import "@sjsf/daisyui5-theme/extra-widgets/switch-include"
import "@sjsf/daisyui5-theme/extra-widgets/textarea-include"
import type {
ClassValue,
HTMLAttributes,
HTMLButtonAttributes,
HTMLFormAttributes,
HTMLInputAttributes,
HTMLLabelAttributes,
HTMLSelectAttributes,
HTMLTextareaAttributes,
} from "svelte/elements";
import type { ButtonType, LayoutType } from "@sjsf/form/fields/components";
import type { CalendarDateProps } from "cally";
import type { PikadayOptions } from "pikaday";
type MapEvents<T> = {
[K in keyof T as K extends `on${infer E}` ? `on:${Lowercase<E>}` : K]: T[K];
};
type CalendarProps = MapEvents<CalendarDateProps> & {
class?: ClassValue | null;
placeholder?: string;
};
export interface UiOptions {
/**
* Overrides the attributes of any button component.
*/
button?: HTMLButtonAttributes;
/**
* Overrides the attributes of a button with a specific type.
* This override takes precedence over the `button` override, but does not replace it.
*/
buttons?: {
[B in ButtonType]?: HTMLButtonAttributes;
};
/**
* Overrides the attributes of the description.
*/
descriptionAttributes?: HTMLAttributes<HTMLDivElement>;
/**
* Overrides the attributes of the errors list.
*/
errorsList?: HTMLAttributes<HTMLUListElement>;
form?: HTMLFormAttributes;
/**
* Overrides the attributes of the help.
*/
helpAttributes?: HTMLAttributes<HTMLDivElement>;
/**
* Overrides the attributes of the field label.
*/
labelAttributes?: HTMLLabelAttributes;
/**
* 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>;
};
submitButton?: HTMLButtonAttributes;
/**
* Overrides the attributes of the field title
*/
titleAttributes?: HTMLAttributes<HTMLDivElement>;
checkbox?: HTMLInputAttributes;
number?: HTMLInputAttributes;
select?: HTMLSelectAttributes;
text?: HTMLInputAttributes;
checkboxes?: HTMLInputAttributes;
datePicker?: HTMLInputAttributes;
file?: HTMLInputAttributes;
multiSelect?: HTMLSelectAttributes;
radio?: HTMLInputAttributes;
range?: HTMLInputAttributes;
textarea?: HTMLTextareaAttributes;
daisyui5CallyCalendarDateFormatter?: (date: string) => string;
daisyui5CallyCalendarTrigger?: HTMLButtonAttributes;
daisyui5CallyCalendar?: CalendarProps;
daisyui5Filter?: HTMLAttributes<HTMLDivElement>;
daisyui5FilterItem?: HTMLInputAttributes;
daisyui5PikadayCalendar?: HTMLInputAttributes;
daisyui5PikadayCalendarOptions?: PikadayOptions;
daisyui5RadioButtons?: HTMLInputAttributes;
daisyui5Rating?: HTMLInputAttributes;
daisyui5Switch?: HTMLInputAttributes;
}