| 1 | --- |
| 2 | title: "htmx:process:{type}" |
| 3 | description: "Custom template processing" |
| 4 | --- |
| 5 | |
| 6 | The `htmx:process:type` event is an internal event fired when a `<template>` tag has a custom `type` attribute that needs processing. |
| 7 | |
| 8 | ## When It Fires |
| 9 | |
| 10 | When htmx encounters a `<template>` element with a custom type attribute during processing. |
| 11 | |
| 12 | ## Event Detail |
| 13 | |
| 14 | - `ctx` - Processing context |
| 15 | - `tasks` - Array of processing tasks |
| 16 | |
| 17 | ## Example |
| 18 | |
| 19 | ```html |
| 20 | <template type="custom-widget"> |
| 21 | <!-- Custom template content --> |
| 22 | </template> |
| 23 | ``` |
| 24 | |
| 25 | ```javascript |
| 26 | htmx.on('htmx:process:custom-widget', (evt) => { |
| 27 | console.log('Processing custom template'); |
| 28 | // Handle custom template type |
| 29 | }); |
| 30 | ``` |
| 31 | |
| 32 | This allows extensions to define custom template processing logic. |