D-pads, Alerts and Brackets
component swaps the button's shape for a ready-made drawing whose parts (segments) each take their own colours and actions: a D-pad, the Voyager D-pad, the alert symbol and bracket arcs.
- A component draws to the height of its grid cell and keeps its proportions. In a sections view it asks for 6 columns and 5 rows (
alert4 rows,dpad_voyager6);grid_optionsin your config changes that. - Text fields go into the component's zones with
zone(such ascenter); every component also has afullzone covering the whole drawing. See Zones.
dpad
component: dpad draws a nine-part direction pad, each part with its own action. Use it for a TV remote, a camera mount or a media player.
- The segments are
up,down,left,right,centerand the cornersup-left,up-right,down-left,down-right.defaultsets keys for every segment at once. - A segment without a
tap_actiondoes nothing when tapped; the card's owntap_actiondoesn't run for it.
type: custom:lcards-button
component: dpad
dpad:
segments:
# every segment: gray, and a hold opens the TV's dialog
default:
style:
fill: var(--lcars-gray)
hold_action:
action: more-info
center:
entity: media_player.tv
style:
fill:
default: var(--lcars-orange)
hover: var(--lcars-yellow)
tap_action:
action: perform-action
perform_action: media_player.media_play_pause
target:
entity_id: media_player.tv
up:
style:
fill: var(--lcars-blue)
tap_action:
action: perform-action
perform_action: media_player.volume_up
target:
entity_id: media_player.tv
down:
style:
fill: var(--lcars-blue)
tap_action:
action: perform-action
perform_action: media_player.volume_down
target:
entity_id: media_player.tvMore about dpad
- Zones: text zones use underscores (
up_left,down_right), while the segments use hyphens (up-left). A text field withoutzonegoes into the first zone,up. - Order: the theme's D-pad colours, then
segments.default, then the segment's own keys, so a segment's ownstylewins overdefaultanddefaultover the theme. A state map with nohoverorpressedkeeps those of the colour it replaces (the theme's pointer colours), so the segment still reacts to the pointer; it does not keep the theme'sinactiveorunavailable. The same holds on every component.
| Key | Type | Default | Description |
|---|---|---|---|
dpad.segments.default | object | - | Segment keys for every segment |
dpad.segments.<id> | object | the theme's D-pad colours | Segment keys for one segment: up, down, left, right, center, up-left, up-right, down-left, down-right |
Segment keys
The keys a segment takes, on every component and in custom SVG. A style colour can be a state map, with hover and pressed keys for the pointer.
- A segment follows the card's
entityunless it sets its own, so one D-pad can show several devices.
type: custom:lcards-button
component: dpad
dpad:
segments:
center:
entity: light.living_room
tap_action:
action: toggle
hold_action:
action: more-info
style:
fill:
active: var(--lcars-yellow)
inactive: var(--lcars-gray)
stroke: var(--lcars-orange)
stroke-width: 2| Key | Type | Default | Description |
|---|---|---|---|
entity | string | the card's entity | The entity this segment shows and acts on |
tap_action | object | - | What a tap on the segment does: see Actions |
hold_action | object | - | What a hold does |
double_tap_action | object | - | What a double tap does |
style.fill | colour / state map | from the component | Fill colour |
style.stroke | colour / state map | from the component | Outline colour |
style.stroke-width | number / string / state map | from the component | Outline width in px (0 to 50), or a CSS length |
style.opacity | number / state map | - | Opacity, 0 to 1 |
text | string | - | Text written into the segment's element, for an SVG <text> element. May be a template |
animations | list | - | Animations on this segment only: the same entries as the card's animations |
selector | string | #<segment id> | CSS selector for the part of the drawing, to target several elements at once |
dpad_voyager
component: dpad_voyager draws the D-pad as on Voyager's consoles, with every shape of the artwork a segment of its own. It has 56 segments; configure them under dpad_voyager.segments with the same segment keys.
- The main segments are
center,up_arrow,down_arrow,left_arrow,right_arrowand the cornersup_left,up_right,down_left,down_right. - Each arm also has
<arm>_shaft,<arm>_outerand<arm>_ring(and the up armup_innerandup_seam). The decorative band round them isring_<direction>_<n>(such asring_up_1orring_upright_2),ring_down,ring_downright,top_bar_1totop_bar_7andaccent_1toaccent_6.
type: custom:lcards-button
component: dpad_voyager
dpad_voyager:
segments:
center:
entity: light.demo
tap_action:
action: toggle
style:
fill:
active: var(--lcards-orange)
inactive: var(--lcards-gray)
up_arrow:
tap_action:
action: perform-action
perform_action: media_player.volume_up
target:
entity_id: media_player.tv
down_arrow:
tap_action:
action: perform-action
perform_action: media_player.volume_down
target:
entity_id: media_player.tvMore about dpad_voyager
- Zones: every segment is also a text zone of the same name, so a label can sit on any part. A text field without
zonegoes intoup_left.
| Key | Type | Default | Description |
|---|---|---|---|
dpad_voyager.segments.default | object | - | Segment keys for every segment |
dpad_voyager.segments.<id> | object | the theme's D-pad colours | Segment keys for one segment |
Brackets
A round display: brackets frames a reading between two arcs. Put a number or label in the center zone with a text field.
bracketshas the segmentsleftandright, and the zonescenter,leftandright.- For a radar scope with a turning sweep and contacts, use the Astrometrics card's Radar scope starter.
type: custom:lcards-button
component: brackets
text:
label:
content: "88"
position: center
font_size: 48
color: theme:colors.ui.tertiary| Key | Type | Default | Description |
|---|---|---|---|
brackets.segments.default | object | - | Segment keys for both arcs |
brackets.segments.<id> | object | the theme's secondary colour | Segment keys for left or right |
alert
component: alert draws the Starfleet alert symbol: a shield with bars that sweep in light, and two lines of text. preset picks the condition, and ranges can switch it by a sensor's value.
- The presets are
default,condition_red,condition_yellow,condition_blue,condition_green,condition_grayandcondition_black. Each sets the shield and bar colours, the sweep colours and the text (ALERToverCONDITION: RED...). - The text fields are
alert_text(zonealert_line) andsub_text(zonesub_line); settext.alert_text.contentto change the words.
type: custom:lcards-button
component: alert
preset: condition_yellow
alert:
color:
shape: var(--lcars-orange)
text:
sub_text:
content: "DECK 7"More about alert
- Your own presets:
alert.custom_presetsadds presets or changes built-in ones, keyed by name. A preset with the name of a built-in one is merged over it, so you give only what changes. Each takessegments.shape.style.fill,segments.bars.style.strokeandtext.<field>.content/text.<field>.color, andextends: <preset>builds on another preset. - Order: the component's colours, then the preset's, then
alert.color, thenalert.segments; a matching range'scolorwins over all of them while it matches. - The sweep: the bars' light sweep is two looping
on_loadanimations with the idsbars-top-sweepandbars-bottom-sweep. An entry inanimationswith the sameidchanges it.
| Key | Type | Default | Description |
|---|---|---|---|
preset | string | default | The condition: default, condition_red, condition_yellow, condition_blue, condition_green, condition_gray, condition_black, or one of your custom_presets |
alert.color.shape | colour | from the preset | Fill of the shield |
alert.color.bars | colour | from the preset | Colour of the bars |
alert.segments.shape.style.fill | colour | from the preset | Fill of the shield, as a segment style |
alert.segments.bars.style.stroke | colour | from the preset | Colour of the bars, as a segment style |
alert.custom_presets | object | - | Your own or changed presets, keyed by name |
ranges
ranges switches the component's preset by the entity's value: red alert above 80, yellow from 50. The first entry that matches wins; when none matches, the card's preset (or default) is used.
aboveandbeloware strict (>and<);at_leastandat_mostinclude the value itself. Combine one of each for a band, as in the example, so neighbouring bands meet without a gap.- The value is the entity's state, or the attribute in
ranges_attribute(or the entry's ownattribute).brightness_pctis a light's brightness as 0 to 100.
type: custom:lcards-button
component: alert
entity: sensor.threat_level
ranges:
- preset: condition_red
at_least: 80 # 80 and up
- preset: condition_yellow
at_least: 50 # 50 up to 80
below: 80
- preset: default
below: 50More about ranges
- Text values:
equalscompares as text, so it also matches states such as"on"or"armed_away". An entry withequalsignores its number keys. - Changed meaning:
aboveused to include the value itself here (>=). A range that relied on a value landing exactly on anaboveboundary now needsat_least. - Attributes: ranges are checked on every update, so a range on an attribute (a light's brightness) switches even when the state stays
on.
| Key | Type | Default | Description |
|---|---|---|---|
ranges[].preset | string | required | The component preset to use while this entry matches |
ranges[].above | number | - | Matches when the value is greater than this |
ranges[].at_least | number | - | Matches when the value is this or greater |
ranges[].below | number | - | Matches when the value is less than this |
ranges[].at_most | number | - | Matches when the value is this or less |
ranges[].equals | string / number / boolean | - | Matches when the value is exactly this, compared as text |
ranges[].attribute | string | ranges_attribute | The attribute this entry compares |
ranges[].color.shape | colour | - | Shield fill while this entry matches |
ranges[].color.bars | colour | - | Bar colour while this entry matches |