Compose styles from snippets
card_builder_build_stylesMerge reusable style snippets and optional overrides to assemble a block's styles or dz_styles. Use when building styles from presets instead of hand-writing.
Instructions
Compose a styles object from one or more built-in snippets plus optional overrides.
Merges each named entry from STYLE_SNIPPETS in order, then extra,
at the property level — later entries override earlier ones for the
same category/property; makes no call to Home Assistant.
Use when: assembling a block's styles/dz_styles from reusable
presets instead of hand-writing the full envelope.
Returns: {<target>: {containers: {<container>: {<category>: {<prop>: <value>, ...}, ...}}}}.
Errors: {"error": "unknown_snippet", "name": ..., "known": [...]}
when a name in snippet_names isn't a known snippet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| extra | No | Extra ContainerStyleData ({category: {prop: {value, unit}}}) merged in last, overriding the snippets. Omit for none. | |
| target | No | Style target key to wrap the result under, e.g. 'block' or 'state'. Defaults to 'block'. | block |
| container | No | Responsive container to wrap the result under: 'desktop', 'tablet', or 'mobile'. Defaults to 'desktop'. | desktop |
| snippet_names | Yes | Ordered list of snippet names from card_builder_list_style_snippets to merge, e.g. ['card_padded', 'vertical_stack']. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||