Important
|
Visual Customization Controls (VCCs) are deprecated and are included only for backwards compatibility. Use the Frontend UI/Capture component of the @withkoji/core package instead. |
Visual Customization Controls (VCCs) enable users to quickly edit elements of your template on Koji. The control types and default values are defined in JSON files in your project. During remixes, the associated visual controls allow a user to enter or select a custom value.
To use VCCs in your template, add a customization file to the .koji/customization
folder of your project.
The customization file defines the names, types, configuration options, and default values for VCCs used in the template.
{
"example": { (1)
"param": "this is the value of the param"
},
"@@initialTransform": { (2)
"example": {
"param": "this is the placeholder text for new remixes"
}
},
"@@editor": [ (3)
{
"key": "example", (4)
"name": "Example", (5)
"icon": "😄", (6)
"source": "example.json", (7)
"fields": [ (8)
{
"key": "param", (9)
"name": "An Example Parameter", (10)
"description": "My description of the parameter", (11)
"type": "image", (12)
"typeOptions": { (13)
}
}
]
}
]
}
<scope>
– Section that defines the scope and default values for customizable elements.
Default values are used in the published template.
@@initialTransform
– (Optional) Section that defines the placeholder values for new remixes.
For keys defined in this section, the placeholder value is used as the starting value for new remixes.
For other keys, the VCC value from the remixed Koji is used.
@@editor
– Section that defines how VCCs are displayed to remixers.
key
– Scope used to access values in your template logic.
Should match the filename.
name
– Name displayed in the Koji editor for developers.
icon
– (Optional) Icon displayed in the Koji editor for developers.
source
– Filename from which to obtain values.
Should be the same file, in most cases.
fields
– Array of VCC definitions.
key
– Key used to access the value in your template logic.
name
– Display name of the element for remixers.
description
– (Optional) Description of the element for remixers.
type
– VCC type.
typeOptions
– (Optional) Configuration options for the VCC.
The available options vary by type.
The Koji platform provides built-in VCCs for standard elements, such as images, text, and sounds. To provide more specialized customization types, you can use custom VCCs published on the Koji platform and you can build your own custom VCCs.
To compose higher-order controls, you can combine VCCs into arrays or objects. You can also combine arrays and objects to create more elaborate controls.
toggle a Boolean value on or off (true
or false
).
select a color from a swatch or enter a color code (HEX, RGB, and HSL).
specify a coordinate pair (x,y).
upload any file.
select an image by selecting from the available options, uploading, or entering a URL.
paste an external URL, create a new Koji from a template, or select an existing Koji from their profile.
select an image, file, sound, or video by selecting from the available options, uploading, or entering a URL.
browse and import 3D objects from Google Poly.
drag a slider to specify a numeric value within a certain range.
store sensitive data in a VCC without the value being visible when the project is remixed.
make a selection from a predefined list of options.
specify a (width, height) pair.
select a sound either by selecting from the available options, uploading, or entering a URL.
change text by clicking the input field and entering the new text.
upload video files.
select a font family from Google Fonts.
create a list of values of the same type with a single VCC definition.
define an object that is composed of multiple VCCs.