A tagged template combines a template literal with a function. The tag receives markup or CSS in a concise form and can interpret the literal parts and interpolated values, making component internals easier to organize than large innerHTML strings. section 6.0 section 6.6
Use the pattern incrementally:
- Place a function immediately before the template literal: html`...` or css`...`. section 6.6
- Insert values with interpolation, including nested tagged templates such as html`<option>${i.name}</option>`. section 6.6
- Use lit-html's repeat directive to turn arrays into repeated HTML, such as menu options. section 6.6
Rendering a menu
A component can return html`<select>${repeat(props.logoChoices, (i) => i.id, (i) => html`<option value="${i.uri}">${i.name}</option>`)}</select>`. Event handlers can also be interpolated with attributes such as @change, allowing the template to call updateGraphics when a selection changes.
Diagram the parts of a tagged function and its relationship to a template literal. section 6.6

