0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-24 08:17:29 +01:00
svelte/documentation/docs/05-special-elements/03-svelte-body.md
Rich Harris 4f6bb41030
More docs stuff (#13769)
* fix

* link

* more docs stuff

* more

* more

* fix

* more

* more

* fix

* fix

* more

* ffs

* FML
2024-10-22 02:11:35 -04:00

16 lines
580 B
Markdown

---
title: <svelte:body>
---
```svelte
<svelte:body onevent={handler} />
```
Similarly to `<svelte:window>`, this element allows you to add listeners to events on `document.body`, such as `mouseenter` and `mouseleave`, which don't fire on `window`. It also lets you use [actions](use) on the `<body>` element.
As with `<svelte:window>` and `<svelte:document>`, this element may only appear the top level of your component and must never be inside a block or element.
```svelte
<svelte:body onmouseenter={handleMouseenter} onmouseleave={handleMouseleave} use:someAction />
```