| 1 | --- |
| 2 | title: "htmx.config.morphSkip" |
| 3 | description: "Skip morphing for specific elements" |
| 4 | --- |
| 5 | |
| 6 | The `htmx.config.morphSkip` option is a CSS selector for elements to skip during morphing. |
| 7 | |
| 8 | Matching elements won't be morphed. They stay exactly as they are. |
| 9 | |
| 10 | **Default:** `'[hx-morph-skip]'` |
| 11 | |
| 12 | Add `hx-morph-skip` to any element in your server templates to freeze it entirely during morph: |
| 13 | |
| 14 | ```html |
| 15 | <custom-widget hx-morph-skip>...</custom-widget> |
| 16 | ``` |
| 17 | |
| 18 | Or override with any CSS selector: |
| 19 | |
| 20 | ```javascript |
| 21 | htmx.config.morphSkip = ".no-morph"; |
| 22 | ``` |
| 23 | |
| 24 | ## Use Cases |
| 25 | |
| 26 | **Third-party widgets:** |
| 27 | Preserve complex widgets that manage their own state. |
| 28 | |
| 29 | **Active animations:** |
| 30 | Skip elements with ongoing CSS or JavaScript animations. |
| 31 | |
| 32 | **Client-side state:** |
| 33 | Protect elements with complex state that would be lost. |
| 34 | |
| 35 | **Multiple selectors:** |
| 36 | ```javascript |
| 37 | htmx.config.morphSkip = ".widget, .animated, custom-element"; |
| 38 | ``` |