summaryrefslogtreecommitdiff
path: root/docs/src/pages/reference/api-reference.md
diff options
context:
space:
mode:
authorGravatar Jonathan Neal <jonathantneal@hotmail.com> 2021-09-15 11:27:59 -0400
committerGravatar GitHub <noreply@github.com> 2021-09-15 11:27:59 -0400
commit98d785af1d8f1f1044db5e8b3364eec0e4d580be (patch)
treed1a6a11fee5f6950c842a9c1a35abeb80fd7b60a /docs/src/pages/reference/api-reference.md
parent8f727647af387464140480f5c6f2cc689098968f (diff)
downloadastro-98d785af1d8f1f1044db5e8b3364eec0e4d580be.tar.gz
astro-98d785af1d8f1f1044db5e8b3364eec0e4d580be.tar.zst
astro-98d785af1d8f1f1044db5e8b3364eec0e4d580be.zip
Expose slots to components (#1368)
* Expose slots to components via Astro.slots * test: Add Astro.slots API tests * docs: Document Astro.slots API * docs: Duplicate Astro.slots documentation to other api-reference markdown * Update proposal to use booleans, based upon RFC feedback * update implementation & tests based on request * changeset
Diffstat (limited to 'docs/src/pages/reference/api-reference.md')
-rw-r--r--docs/src/pages/reference/api-reference.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/src/pages/reference/api-reference.md b/docs/src/pages/reference/api-reference.md
index 624ed2986..08178b4b5 100644
--- a/docs/src/pages/reference/api-reference.md
+++ b/docs/src/pages/reference/api-reference.md
@@ -86,6 +86,17 @@ const path = Astro.site.pathname;
<h1>Welcome to {path}</h1>
```
+### `Astro.slots`
+
+`Astro.slots` returns an object with any slotted regions passed into the current Astro file.
+
+```js
+const {
+ heading as headingSlot, // true or undefined, based on whether `<* slot="heading">` was used.
+ default as defaultSlot, // true or undefined, based on whether `<* slot>` or `<* default>` was used.
+} = Astro.slots;
+```
+
## `getStaticPaths()`
If a page uses dynamic params in the filename, that component will need to export a `getStaticPaths()` function.