-
Notifications
You must be signed in to change notification settings - Fork 10
Configurable inputs
Damir Perisic edited this page Nov 3, 2020
·
41 revisions
Configurable inputs are elements that can be associated with the repository, activity, or content element entity in order to store additional data about the entity. They are extensible and can be installed as a plugin.
- type - input type, the
id
of the element being used to collect the data - key - property name that will be used to store input data, should be in
camelCase
- label
const example = {
type: 'INPUT',
key: 'exampleInput',
label: 'Example input'
};
....
Pre-installed core inputs:
- Standard input
- Text Area
- Select
- Checkbox
- Switch
- Date picker
- File upload
- HTML input
- Color picker
meta: [{
"key": "inputKey",
"type": "INPUT",
"label": "Input field",
"placeholder": "Click to add...",
"validate": {
"rules": {
"required": false,
"max": 250
}
}
}]
meta: [{
"key": "textareaKey",
"type": "TEXTAREA",
"label": "Description",
"placeholder": "Click to add...",
"validate": {
"rules": {
"required": false,
"max": 250,
"min": 5
}
}
}]
meta: [{
"key": "checkboxKey",
"type": "CHECKBOX",
"label": "Generic checkbox label",
"description": "Description for a checkbox"
}]
meta: [{
"key": "switchKey",
"type": "SWITCH",
"label": "Generic switch label",
"description": "Description for a switch"
}]
meta: [{
"key": "colorKey",
"type": "COLOR",
"label": "Pick a color"
}]
To enable multiselect change the multiple prop to true.
meta: [{
"key": "selectKey",
"type": "SELECT",
"label": "Select From List",
"multiple": false,
"options": [{
"label": "selection 1",
"value": 5
}, {
"label": "selection 2",
"value": 10
}, {
"label": "selection 3",
"value": 15
},
{
"label": "Advocate",
"value": 20,
"img": "https://s3.amazonaws.com/gol-badges/advocate.svg"
},
{
"label": "Ally",
"value": 25,
"img": "https://s3.amazonaws.com/gol-badges/ally.svg"
},
{
"label": "Coach",
"value": 30,
"img": "https://s3.amazonaws.com/gol-badges/coach.svg"
},
{
"label": "Leveling Up",
"value": 35,
"img": "https://s3.amazonaws.com/gol-badges/leveling_up.svg"
}]
}]
Note: to disable time picker, change hideTime prop to false
meta: [{
"key": "datePicker",
"type": "DATETIME",
"label": "date picker",
"hideTime": false
}]
meta: [{
"key": "html",
"type": "HTML",
"label": "html with quill"
}]
meta: [{
"key": "file",
"type": "FILE",
"label": "File Upload",
"placeholder": "Click to add...",
"validate": {
"rules": {
"ext": [
"pdf",
"xlsx",
"mp3",
"ogg",
"wma",
"rar",
"tar.gz",
"7z",
"zip",
"jpg",
"jpeg",
"png",
"xml",
"tar"
]
}
}
}]