mirror of
https://github.com/zhigang1992/firecms.git
synced 2026-06-16 18:40:00 +08:00
1.7 KiB
1.7 KiB
id, title, sidebar_label
| id | title | sidebar_label |
|---|---|---|
| number | Number | Number |
import { buildProperty } from "./builders";
const rangeProperty = buildProperty({
title: "Range",
validation: {
min: 0,
max: 3
},
dataType: "number"
});
config
enumValues
You can use the enum values providing a map of possible exclusive values the property can take, mapped to the label that it is displayed in the dropdown.
import { buildProperty } from "./builders";
const property = buildProperty({
title: "Status",
dataType: "number",
config: {
enumValues: new Map([
["-1", buildEnumValueConfig({
label: "Lightly tense",
color: "redLighter"
})],
["0", buildEnumValueConfig({
label: "Normal",
color: "grayLight"
})],
["1", buildEnumValueConfig({
label: "Lightly relaxed",
color: "blueLighter"
})]
])
}
});
validation
requiredShould this field be compulsory.requiredMessageMessage to be displayed as a validation error.minSet the minimum value allowed.maxSet the maximum value allowed.lessThanValue must be less than.moreThanValue must be more than.positiveValue must be a positive number.negativeValue must be a negative number.integerValue must be an integer.
The widget that gets created is
TextFieldgeneric text fieldSelectifenumValuesare set in the string config, this field renders a select where each option is a colored chip.
Links: