# Dynamic user driven display

**URL:** <https://discourse.aurelia.io/t/dynamic-user-driven-display/4879>\
**Category:** Help Requests\
**Created:** [August 16, 2022, 3:51pm UTC](https://discourse.aurelia.io/t/dynamic-user-driven-display/4879 "2022-08-16T15:51:34Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Sayan751](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/sayan751/32/1861_2.png) [@Sayan751](https://discourse.aurelia.io/u/Sayan751)\
**Post date:** [August 16, 2022, 6:48pm UTC](https://discourse.aurelia.io/t/dynamic-user-driven-display/4879/5 "2022-08-16T18:48:46Z")

</div>

In your place, I would have done the following:

- Create a custom element (CE) that accepts a template string and a binding context or scope.
- That CE is responsible for the following:
  - Parsing the template string to a DOM tree. Don’t worry about the Aurelia syntax for this part, and simply use the standard [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser).
  - Enhancing the DOM tree with the bound context, using the `templatingEngine.enhance`(if you are unaware of that, search for that in the [docs](http://aurelia.io/docs/fundamentals/app-configuration-and-startup#leveraging-progressive-enhancement)). This step will hydrate the DOM tree with Aurelia magic.
  - Attach the enhanced DOM tree to the view, and you are done.
  - Well almost. Make sure to clean up properly when this CE goes out of context (unbound, detached etc.). For that, you can refer [this thread](https://discourse.aurelia.io/t/handling-lifecycle-when-using-compose-from-a-view-model/4872/2).

- Use the CE in your list and bind the template and the context as deemed fit.

---

_[View the full topic](https://discourse.aurelia.io/t/dynamic-user-driven-display/4879)._
