-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support setting rootMargin for
client:visible
(#9363)
* feat: support setting rootMargin for `client:visible` This support adding optional `rootMargin` to the `IntersectionObserver` options. This gives the developer the optional choice to hydrate a bit before the astro-island enters the viewport. * chore: update type for client:visible * chore: added changeset * chore: update types * fix: check if value is string * Update stupid-peas-juggle.md * fix: update .changeset/stupid-peas-juggle.md Co-authored-by: Sarah Rainsberger <[email protected]> --------- Co-authored-by: Florian Lefebvre <[email protected]> Co-authored-by: Bjorn Lu <[email protected]> Co-authored-by: Sarah Rainsberger <[email protected]>
- Loading branch information
1 parent
f33fe31
commit 769826e
Showing
3 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Extends the `client:visible` directive by adding an optional `rootMargin` property. This allows a component to be hydrated when it is close to the viewport instead of waiting for it to become visible. | ||
|
||
```html | ||
<!-- Load component when it's within 200px away from entering the viewport --> | ||
<Component client:visible="200px" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters