API Reference
@formkit/themes
Introduction
This package contains the official themes for FormKit. Read the installation documentation for more information.
Functions
Returns a function responsible for loading an icon by name.
Signature
createIconHandler(iconLoader?: FormKitIconLoader, iconLoaderUrl?: FormKitIconLoaderUrl): FormKitIconLoader;
Parameters
iconLoaderoptional — a function for loading an icon when it's not found in the iconRegistry.iconLoaderUrloptional — a function that returns a remote URL for retrieving an SVG icon by name.
Creates the theme plugin based on a given theme name.
Signature
createThemePlugin(theme?: string, icons?: Record<string, string | undefined>, iconLoaderUrl?: FormKitIconLoaderUrl, iconLoader?: FormKitIconLoader): (node: FormKitNode) => any;
Parameters
themeoptional — The name or id of the theme to apply.iconsoptional — Icons you want to add to the global icon registry.iconLoaderUrloptional — A function that returns a remote url for retrieving an SVG icon by name.iconLoaderoptional — A function that handles loading an icon when it is not found in the registry.
A function to generate FormKit class functions from a JavaScript object.
Signature
generateClasses(classes: Record<string, Record<string, string>>): Record<string, string | FormKitClasses | Record<string, boolean>>;
Parameters
classes— An object of input types with nested objects of sectionKeys and class lists.
Returns
An object of sectionKeys with class functions.
TypeScript
A function that returns an icon SVG string.
interface FormKitIconLoader {
(iconName: string): string | undefined | Promise<string | undefined>;
}
A function that returns a remote URL for retrieving an SVG icon by name.
interface FormKitIconLoaderUrl {
(iconName: string): string | undefined;
}