Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sitemap] New optional icon in mappings #2148

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ui/sitemaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ A Switch will present a discrete state Item and allow changing of its value.
Note that Switch elements can be rendered differently on the user interface, based on the Item type and the `mappings` parameter.

- `mappings` comes as an array of value-to-string translations, [documented further down](#mappings).
Without the mappings parameter, user interfaces will present an On/Off Switch, if mappings are given, several labeled buttons will be rendered.
Without the mappings parameter, user interfaces will present an On/Off Switch, if mappings are given, several buttons with label or icon will be rendered.

**Examples:**

Expand Down Expand Up @@ -540,7 +540,7 @@ Mappings is an optional parameter for the [Switch](#element-type-switch) and [Se
Mapping syntax:

```java
mappings=[value_1="description_1", value_2="description_2", ...]
mappings=[value_1="description_1", value_2="description_2"=<iconname>, ...]
```

Examples:
Expand All @@ -551,6 +551,8 @@ mappings=[1="DasErste", 2="BBC One", 3="Cartoon Network"]

mappings=[OFF="All heaters off"]
mappings=[15="Gone", 19="Chilly", 21="Cozy"]

mappings=[ON="Mic On"=material:mic, OFF="Mic Off"=material:mic_off]
```

As you can see, different Item data types are accepted as mappings values.
Expand All @@ -566,6 +568,9 @@ Similarly, mapping above changes the numbers "1", "2", and "3" to "DasErste", "B
In the third and fourth examples above, only a subset of the possible values of items belonging to a heating system are presented to the user.
This limits the possible input values, which is yet another often occurring use case for mappings.

In the fifth example above, user interfaces will display buttons using the provided icon rather than the provided description.
Icons are usable in Switch element but ignored in Selection element.

## Dynamic Sitemaps

All Sitemap elements can be configured to be hidden, color highlighted or to have a [dynamic icon]({{base}}/configuration/items.html#dynamic-icons), depending on certain Item states.
Expand Down