You are reading the development docs (2026.12.1-dev.1): features here may not be released yet.
Skip to content

Text Fields ​

text puts any number of labels on a button, elbow or slider, each one placed and styled on its own. You name each field (label, value, unit ...), give it content, and say where it goes.

  • Every key under text except default is a field that is drawn. text.default holds the style every field starts from, so a field only sets what differs.
  • Fields go into zones: named areas of the card such as a slider's track or an elbow's horizontal_bar. position then places the text within its zone.
  • content takes templates, so a field can show an entity's state, a sum or a server-side Jinja2 value.
  • The astrometrics card uses the same keys for its point labels, placed round the point instead of in zones.

Try it

The card editor's Text tab (Text Fields on the slider) adds and styles fields with a live preview; the Zones tab shows and adds zones.

PageCovers
Placing Textposition, padding, exact coordinates, alignment and rotation
ZonesThe zones each card has, your own zones, and the zone outlines
Fonts, Colour and BackgroundsFont keys, sizing text to its zone, colour by state, the box behind a label
Content and FormatsTemplates in content, and how entity states are formatted

Quick start ​

A small label and a large reading on one button. Both fields share the font and colour in text.default.

yaml
type: custom:lcards-button
entity: sensor.outdoor_temperature
preset: lozenge
text:
  default:
    font_family: "Antonio, sans-serif"
    color: var(--lcards-moonlight)
  label:
    content: Outdoor
    show: true
    position: top-left
    font_size: 11
    text_transform: uppercase
  value:
    content: "[[[return parseFloat(entity.state).toFixed(1) + '°C']]]"
    position: center
    font_size: 32
    font_weight: bold
    color:
      default: var(--lcards-moonlight)
      unavailable: var(--lcars-alert-red)
grid_options:
  rows: 2

Inheritance ​

text.default is the style every field on the card starts from; it is never drawn itself. Set the font, size and colour once, and only what differs on each field.

  • A field's own key wins over text.default, and text.default wins over the preset's defaults.
  • Padding is merged side by side: a field that sets only padding.top keeps the left and right padding from text.default.
  • What a field inherits is its style and alignment: the font keys, color, position, padding, anchor, baseline, rotation, stretch, fit, display_format and the background keys. content, show, zone, x and y are set per field.
yaml
type: custom:lcards-button
entity: light.kitchen
preset: lozenge
text:
  default:
    font_size: 12
    font_family: "Antonio, sans-serif"
    color: var(--lcards-moonlight)
  label:
    content: Brightness
    show: true
    position: top-left
    # font_size, font_family and color come from default
  value:
    content: "[[[return Math.round((entity.attributes.brightness || 0) / 255 * 100) + '%']]]"
    position: center
    font_size: 28
    font_weight: bold
    color:
      default: var(--lcards-moonlight)
      active: var(--lcars-orange)
grid_options:
  rows: 2
More about inheritance
  • Preset fields: what you write in text.default wins over what a preset sets on one of its own fields (such as the bar-label presets' padding and font_size_percent on label), and a key on the field itself wins over both.
  • style.text.default: on the button, this sets the same style at a lower priority than text.default.
KeyTypeDefaultDescription
textobjectfrom the presetThe fields, keyed by any name you choose
text.defaultobjectfrom the presetStyle every field inherits. It is not drawn
text.<name>object-One field: the keys in Per-field options

Preset-defined fields ​

The button presets already hold three fields, name, state and label, positioned and styled for the preset. Turn one on with show: true, or change its content.

  • Most presets hide all three. The bar-label and panel presets show label; the filled and toggle-tab presets show name.
  • A field with any other name (value, subtitle ...) is yours alone and shows by default.
yaml
type: custom:lcards-button
entity: light.kitchen
preset: lozenge
text:
  name:
    show: true # the entity's name, where the preset puts it
  state:
    show: true # the entity's state, where the preset puts it
  label:
    content: DECK 7
    show: true
grid_options:
  rows: 2
KeyTypeDefaultDescription
text.name.contentstring"{entity.attributes.friendly_name}"The entity's name
text.name.showbooleanfalseShow the name. The base preset puts it bottom right
text.state.contentstring"{entity.state}"The entity's state
text.state.showbooleanfalseShow the state. The base preset puts it top right
text.label.contentstringa random code such as 3f-a2cA general-purpose label: two hex digits, a dash and three more, picked at random by a template
text.label.showbooleanfalseShow the label. The base preset puts it in the centre

Per-field options ​

Every key a field takes, with the page that explains it. All of them also work in text.default except those listed under Inheritance as set per field.

yaml
type: custom:lcards-button
entity: sensor.outdoor_temperature
preset: lozenge
text:
  reading:
    content: "{entity.state}"
    display_format: parts
    position: center-right
    font_size: 20
    letter_spacing: 2
    color: var(--lcars-orange)
KeyTypeDefaultDescription
contentstringfrom the preset, else -The text. Templates work
showbooleantrueShow or hide the field
templatebooleantruefalse shows {...} and [[[...]]] literally: see content
display_formatstringfriendlyHow entity values in content are written: see display_format
zonestringthe card's main zoneThe zone the field goes in: see Zones
Placement keysposition, padding, x, y, x_percent, y_percent, anchor, baseline, rotation
Font keysfont_size, font_family, font_weight, text_transform, letter_spacing
Zone-filling keysfont_size_percent, cap_height_ratio, stretch
fitboolean / object-Shrink, then wrap, then cut a long text to its zone
colorcolour / state mapthe theme's text colourText colour, by state if you like
Background keysbackground, background_padding, background_radius, background_width, background_min_width

Released under the MIT License. | About