Skip to content

Commit

Permalink
document icons property for (combo) fields, closes #56
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrasd committed Jan 20, 2023
1 parent bc8e981 commit c40893d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* :warning: Rename field type `cycleway` to `directionalCombo` ([#79])
* Introduce new `date` field type ([#76])
* Allow the `Röntgen` icon set to be used for icons ([#75])
* Allow to specify icons for values of combo fields ([#56])

[#56]: https://github.com/ideditor/schema-builder/issues/56
[#75]: https://github.com/ideditor/schema-builder/issues/75
[#76]: https://github.com/ideditor/schema-builder/issues/76
[#79]: https://github.com/ideditor/schema-builder/issues/79
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,30 @@ For `identifier` fields, the permalink URL of the external record. It must conta

For `identifier` fields, the regular expression that valid values are expected to match to be linkable.

##### `icons`

For combo fields, the `icons` object might contain the name of icons which represent the different values of the field.

Combo field types can accept key-label pairs in the `options` value of the `strings` property.

```js
{
"key": "crossing:markings",
"type": "combo",
"label": "Crossing Markings",
"icons": {
"zebra": "iD-crossing_markings-zebra",
"lines": "iD-crossing_markings-lines",
}
}
```

##### `iconsCrossReferences`

An optional property to reference to the icons of another field, indicated by using that field's name contained in brackets, like `{field}`. This is for example useful when there are multiple variants of fields for the same tag, which should all use the same icons.


## Contributing

iD's [code of conduct](https://github.com/openstreetmap/iD/blob/release/CODE_OF_CONDUCT.md) and
Expand Down
8 changes: 8 additions & 0 deletions schemas/field.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@
"description": "The manner and context in which the field is used",
"type": "string",
"enum": ["preset", "changeset", "manual", "group"]
},
"icons": {
"description": "For combo fields: Name of icons which represents different values of this field",
"type": "object"
},
"iconsCrossReference": {
"description": "A field can reference icons of another by using that field's identifier contained in brackets, like {field}.",
"type": "string"
}
},
"additionalProperties": false,
Expand Down

0 comments on commit c40893d

Please sign in to comment.