Theme
Essentially theme is a simple function:
const fromRecord = (record) => (type) => record[type]const theme = fromRecord(components)Component types
Section titled “Component types”All components can be divided into four logical types:
- components
formsubmitButtonbuttonlayouttitlelabeldescriptionhelperrorsList
- widgets
textWidgetnumberWidgetselectWidgetcheckboxWidget
- templates
fieldTemplateobjectTemplateobjectPropertyTemplatearrayTemplatearrayItemTemplatemultiFieldTemplate
- fields
stringFieldnumberFieldintegerFieldbooleanFieldobjectFieldarrayFieldtupleFieldnullFieldoneOfFieldanyOfFieldunknownField
Also found out that the above components are enough to display any JSON schema.
Foundational components
Section titled “Foundational components”The FoundationalComponentType is a subset of all components
(ComponentType) that can be explicitly used in form elements.
For example, we can use form as an argument for getComponent because
form is FoundationalComponentType:
<script lang="ts"> ... const Form = $derived(getComponent(ctx, "form", config));</script>
<Form bind:ref {config} {children} {attributes} />The main purpose of this list is to determine which components you can replace
using the ui:components property from UiSchema.
This is an extensible list, but by default it corresponds to the components listed in Component types.
Extra components
Section titled “Extra components”If the default set of components is insufficient, you can add the necessary components yourself.
The @sjsf/form library provides definitions and implementation of several extra
fields, as well as a set of definitions for extra widgets.
Fields
Section titled “Fields”Here is a list of extra fields that can be imported from @sjsf/form/fields/extra/*.
aggregatedarray-filesarray-native-filesarray-tagsboolean-selectenumfilefilesmulti-enumnative-filenative-filestagsunknown-native-file
To use them you can import them directly
import EnumField from "@sjsf/form/fields/extra/enum";or use an include import
import "@sjsf/form/fields/extra/enum-include";and replace the compatible field with it in uiSchema.
const uiSchema: UISchema = { "ui:components": { stringField: EnumField, // Or if you used the `include` import stringField: "enumField" }}Widgets
Section titled “Widgets”There are several types of extra widgets already defined in the library
(@sjsf/form/fields/extra-widgets/*):
aggregatedcheckboxescomboboxdate-pickerfilemulti-selectradio-buttonsradio(group)rangeratingswitchtagstextarea
However, the ability to use them depends on the availability of a corresponding implementation in your chosen theme.