Text¶
The Text tool adds your own text to a card. It can show a heading, caption, unit, fixed label, or combine several pieces such as entity names and states into one positioned text item.
This page shows how to add plain and inline text, combine entity information, use multiple lines, style the text, and keep long labels readable.
Add text¶
Use Text for fixed wording or for a sentence assembled from literal text and entity information.
Style and position the text¶
Position and style Text when it needs to align with the surrounding card content instead of using its basic appearance.
Combine text with entity information¶
Use inline text parts when one line should contain fixed text and entity information together. Each inline part can provide a fixed value or use supported name, state, or area information.
Keep the complete inline configuration inside the Text item so the order and spacing remain obvious.
Start a new line¶
Use new_line on an inline part when the next piece should continue on a new line. Use dx and dy to make small position adjustments between parts.
Keep long text readable¶
text_overflow.mode has three values:
wrap— breaks text over multiple lines. Configure exactly one ofcharactersormax_width;max_lineslimits the number of lines anddysets the spacing between generated lines.ellipsis— shortens text and adds.... Configure exactly one ofcharactersormax_width.fit— reduces the text size until it fits withinmax_width.min_font_sizesets the smallest allowed font size. Fit does not enlarge text, wrap it, or shorten it with....
Wrap text¶
Use characters instead of max_width when wrapping should be based on character count rather than measured width. Do not set both for the same wrap configuration.
Shorten text with an ellipsis¶
Use characters instead of max_width when the limit should be a fixed character count. Do not set both for the same ellipsis configuration.
Shrink text to fit¶
The configured font size is kept when the text already fits. When it is too wide, the card only reduces the size as far as needed, but not below min_font_size.
Configuration options¶
Choose plain text when one value is enough. Choose multipart text when several pieces — for example a label and an entity state — must be rendered together. In both cases the outer Text item still uses text:; localize_tag modifies a text value and does not replace the required text field.
Plain Text item¶
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text | string / number | Yes | — | Text shown to the user. |
xpos | number | Yes | — | Horizontal text position. |
ypos | number | Yes | — | Vertical text position. |
localize_tag | string | No | Not set | Uses a Home Assistant localization key for the configured scalar text. |
Multipart Text item¶
Here text is a list. Each list item is one visible part, in display order.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text | list | Yes | — | Ordered list of literal and/or entity-derived text parts. |
xpos | number | Yes | — | Horizontal position where the combined text starts. |
ypos | number | Yes | — | Vertical position where the combined text starts. |
Literal inline part¶
Use this form for a fixed word, separator, unit, or other literal value inside multipart text.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
value | string / number | Yes | — | Literal value shown by this part. |
type | text | No | text | Keeps this part as the literal value configured in the same part. |
localize_tag | string | No | Not set | Localizes this literal text where a Home Assistant localization key is used. |
Entity-derived inline part¶
Use this form when a part should show a Name, State, or Area instead of fixed text.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
type | name, state, area | Yes | — | name inserts the selected entity name, state inserts its displayed state, and area inserts its Home Assistant area name. |
entity_index | entity index | No | Parent Text entity | Selects another configured entity for this part. |
id | string | No | Not set | Reuses an existing Name, State, or Area item by its id instead of creating the source inline. |
show.uom | none, end, top, bottom | No | Source State default | With type: state, none hides the unit, end places it after the value, top above it, and bottom below it. |
source_styles | boolean | No | true | Keeps the styles of the referenced Name, State, or Area source. |
Options for every inline part¶
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
new_line | boolean | No | false | Starts this part on a new line. |
dx | number | No | 0 | Moves this part horizontally from the current text position; positive moves right, negative left. |
dy | number | No | 0 | Moves this part vertically from the current text position; positive moves down, negative up. |
styles | mapping | No | Source / parent Text style | Changes only this part's appearance. |
ellipsis | number | No | Not set | Shortens this part after the configured character limit. |
Options for every Text item¶
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | No | List position as text | Gives the Text item a name that other card features can reference. If omitted, the card uses the item's zero-based position in layout.texts as a text ID: "0", "1", "2", and so on. |
entity_index | entity index | No | Not set | Makes one configured entity available to the Text item and its templates. |
styles | mapping | No | Default Text style | Sets font size, weight, alignment, color, and other text appearance. |
text_overflow | mapping | No | Not set | Wraps, shortens, or shrinks text when it would otherwise become too wide. mode is wrap, ellipsis, or fit. |
group | string | No | Not set | Places the Text item in a layout group so related items can move together. |
tap_action, hold_action, double_tap_action | mapping | No | Not set | Adds interaction to the complete Text item. |