Kiln API
CSS Classes
Kiln exports a number of CSS classes that may be used by plugins.
JavaScript API
Kiln attaches a window.kiln
object when it has loaded, which contains utilities, vue components, and places to put custom helpers, inputs, validators, etc. Note that you may always override built-in inputs, helpers, validators, etc with your own code if you need to.
Custom Nav Menu Items
You may add options to the Clay menu to be displayed between New Page
and Sign Out
options. The trigger buttons should extend the navMenuButton
component included in window.kiln.components
and should be added to window.kiln.navButtons.
Custom nav buttons should dispatch the openDrawer
action with the same id used to name the nav button and nav content in the global kiln
object.
The body of the nav option should be added to window.kiln.navContent
using the same object key that was used to add the corresponding nav button.
Note that due to the vast difference in functionality and state data between view mode and edit mode, external nav menu options will not be loaded into the nav outside of edit mode.
Custom Validators
You may add custom validation to window.kiln.validators
. A validator should export label
, description
, type
(either error
or warning
), and a validate
method. The validate
method receives the whole page state
, so validators can be extremely flexible.
Most validators concern themselves with components and/or fields, and should make use of the helper functions in kiln.utils.validationHelpers
such as forEachComponent
and forEachField
. The built-in validators such as required
are good examples to work off of.
Validators must return an array of errors (or warnings), where each issue includes uri
, and field
properties. Optionally, an issue may include location
(which creates a link to the relevant form) and preview
(which displays context for an issue).
Utilities
Kiln exports a number of JavaScript utils to the browser in the window.kiln.utils
object.
Vue Components
Kiln exports a number of KeenUI and custom Vue.js components that may be used in plugins.
Vuex State
The Vuex state looks similar to this:
Last updated