MCPcopy Create free account
hub / github.com/formkit/formkit / defaultConfig

Function defaultConfig

packages/react/src/defaultConfig.ts:55–107  ·  view source on GitHub ↗
(
  options: DefaultConfigOptions = {}
)

Source from the content-addressed store, hash-verified

53 * @public
54 */
55export const defaultConfig = (
56 options: DefaultConfigOptions = {}
57): FormKitOptions => {
58 decodeErrors()
59 const {
60 rules = {},
61 locales = {},
62 inputs = {},
63 messages = {},
64 locale = undefined,
65 theme = undefined,
66 iconLoaderUrl = undefined,
67 iconLoader = undefined,
68 icons = {},
69 ...nodeOptions
70 } = options
71 /**
72 * The default configuration includes the validation plugin,
73 * with all core-available validation rules.
74 */
75 const validation = createValidationPlugin({
76 ...defaultRules,
77 ...(rules || {}),
78 })
79
80 /**
81 * Includes the i18n plugin with only the english language
82 * messages.
83 */
84 const i18n = createI18nPlugin(
85 extend({ en, ...(locales || {}) }, messages) as FormKitLocaleRegistry
86 )
87
88 /**
89 * Create the library of inputs that are generally available. This default
90 * config imports all "native" inputs by default, but
91 */
92 const library = createLibraryPlugin(defaultInputs, inputs)
93
94 /**
95 * Create the theme plugin for the user provided theme
96 */
97 const themePlugin = createThemePlugin(theme, icons, iconLoaderUrl, iconLoader)
98
99 return extend(
100 {
101 plugins: [library, themePlugin, bindings, i18n, validation],
102 ...(!locale ? {} : { config: { locale } }),
103 },
104 nodeOptions || {},
105 true
106 ) as FormKitOptions
107}

Callers 15

AppFunction · 0.90
FormKit.spec.tsFile · 0.90
ssr.spec.tsFile · 0.90
HostFunction · 0.90
renderWithFormKitFunction · 0.90
classes.spec.tsFile · 0.90
vModel.spec.tsFile · 0.90
plugin.spec.tsFile · 0.90

Calls 6

createValidationPluginFunction · 0.90
createI18nPluginFunction · 0.90
extendFunction · 0.90
createLibraryPluginFunction · 0.90
createThemePluginFunction · 0.90
decodeErrorsFunction · 0.85

Tested by 2

HostFunction · 0.72
renderWithFormKitFunction · 0.72