# Custom view templates with scripts

**URL:** <https://support.prodi.gy/t/custom-view-templates-with-scripts/302>\
**Category:** Uncategorized\
**Tags:** enhancement, done, front-end\
**Created:** [February 9, 2018, 10:25pm UTC](https://support.prodi.gy/t/custom-view-templates-with-scripts/302 "2018-02-09T22:25:42Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![jlanday](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@jlanday](https://support.prodi.gy/u/jlanday)\
**Post date:** [March 7, 2019, 7:05pm UTC](https://support.prodi.gy/t/custom-view-templates-with-scripts/302/19 "2019-03-07T19:05:13Z")

</div>

Hi,

Sorry for the delay…

First, I have textcat\_eval.js which is the following:

```javascript
function updateFromInput() {
    const text = document.querySelector('.input').value;
    window.prodigy.update({ user_text: text });
}

```

Second, I have textcat.html which is the following:

```python
<h2>{{text}}</h2>

<input type="text" class="input" placeholder="User text here..." />
<button onClick="updateFromInput()">Update</button>
<br />
{{user_text}}

```

Finally, my recipe is the following:

```python

import prodigy
from prodigy.components.loaders import JSONL

with open('textcat_eval.html') as txt:
    template_text = txt.read()
with open('textcat_eval.js') as txt:
    script_text = txt.read()

@prodigy.recipe('sentiment',dataset=prodigy.recipe_args['dataset'],file_path=("Path to texts", "positional", None, str))
def sentiment(dataset, file_path):
    """Annotate the sentiment of texts using different mood options."""
    stream = JSONL(file_path) # load in the JSONL file
    return {
        'dataset':dataset,
        'stream':stream,
        'view_id': 'html',
        'config': {
            'html_template': template_text,
            'html_script': script_text,
        }
    }

```

Thanks again !

---

_[View the full topic](https://support.prodi.gy/t/custom-view-templates-with-scripts/302)._
