# Component attributes do not support complex content

**URL:** <https://forum.radzen.com/t/component-attributes-do-not-support-complex-content/20165>\
**Category:** Radzen.Blazor Components\
**Created:** [April 17, 2025, 1:31pm UTC](https://forum.radzen.com/t/component-attributes-do-not-support-complex-content/20165 "2025-04-17T13:31:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhon\_gold](https://forum.radzen.com/user_avatar/forum.radzen.com/jhon_gold/32/21160_2.png) [@jhon\_gold](https://forum.radzen.com/u/jhon_gold)\
**Post date:** [April 17, 2025, 1:31pm UTC](https://forum.radzen.com/t/component-attributes-do-not-support-complex-content/20165/1 "2025-04-17T13:31:08Z")

</div>

Hi.

Im generating components dynamicallt inside a column, i need it to change calor in base of a funcion that returns the color, but i does not work with radzen components:

This works:

> `<div style="@($"background-color:{ResultColor(item)}") ; box-shadow: 0 2px 6px rgba(0,0,0,0.1); border-radius: 0.75rem; border-width: 1px; width:100%;height:100% ">@item</div>`

This not:

> `<RadzenCard style="@($"background-color:{ResultColor(item)}") ; box-shadow: 0 2px 6px rgba(0,0,0,0.1); border-radius: 0.75rem; border-width: 1px; width:100%;height:100% ">@item</RadzenCard>`

And the error is:

> Component attributes do not support complex content (mixed C# and markup). Attribute: 'style', text: '$"background-color:{ResultColor(item)}" ; box-shadow: 0 2px 6px rgba(0,0,0,0.1); border-radius: 0.75rem; border-width: 1px; width:100%;height:100% '

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [April 17, 2025, 3:26pm UTC](https://forum.radzen.com/t/component-attributes-do-not-support-complex-content/20165/2 "2025-04-17T15:26:04Z")

</div>

This is related to razor in general not specific to our components - better build the string in a separate method and use it to set the attribute.
