From f0509d09aa1eb46b31e6ca040772e4ee15eb164b Mon Sep 17 00:00:00 2001 From: Ross Morsali Date: Fri, 26 May 2023 16:42:38 +0200 Subject: [PATCH 1/3] Update README.md Add info and example about `fillProps` prop on `Slot` --- packages/components/src/slot-fill/README.md | 26 ++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/components/src/slot-fill/README.md b/packages/components/src/slot-fill/README.md index 5c7455f6a555e8..cc014039acab19 100644 --- a/packages/components/src/slot-fill/README.md +++ b/packages/components/src/slot-fill/README.md @@ -70,7 +70,7 @@ Both `Slot` and `Fill` accept a `name` string prop, where a `Slot` with a given `Slot` with `bubblesVirtually` set to true also accept an optional `className` to add to the slot container. -`Slot` also accepts optional `children` function prop, which takes `fills` as a param. It allows to perform additional processing and wrap `fills` conditionally. +`Slot` accepts optional `children` function prop, which takes `fills` as a param. It allows to perform additional processing and wrap `fills` conditionally. _Example_: @@ -89,3 +89,27 @@ const Toolbar = ( { isMobile } ) => ( ); ``` + +Props can also be passed from a `Slot` to a `Fill` by using the prop `fillProps` on the `Slot`: +```jsx +const { Fill, Slot } = createSlotFill( 'Toolbar' ); + +const ToolbarItem = () => ( + + { ( { hideToolbar } ) => { + ; + } } + +); + +const Toolbar = () => + const hideToolbar() => { + console.log( 'Hide toolbar' ); + } + return ( +
+ +
+ ); +); +``` From 23102ebcc74e607090e19aeed93fb78cda8541ee Mon Sep 17 00:00:00 2001 From: Ross Morsali Date: Thu, 1 Jun 2023 12:06:34 +0200 Subject: [PATCH 2/3] Update packages/components/src/slot-fill/README.md Co-authored-by: Nick Diego --- packages/components/src/slot-fill/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/slot-fill/README.md b/packages/components/src/slot-fill/README.md index cc014039acab19..6f5f25fe2697bf 100644 --- a/packages/components/src/slot-fill/README.md +++ b/packages/components/src/slot-fill/README.md @@ -70,7 +70,7 @@ Both `Slot` and `Fill` accept a `name` string prop, where a `Slot` with a given `Slot` with `bubblesVirtually` set to true also accept an optional `className` to add to the slot container. -`Slot` accepts optional `children` function prop, which takes `fills` as a param. It allows to perform additional processing and wrap `fills` conditionally. +`Slot` accepts an optional `children` function prop, which takes `fills` as a param. It allows you to perform additional processing and wrap `fills` conditionally. _Example_: From 3623e60ba6878c94b03e48b059d60536a03c468b Mon Sep 17 00:00:00 2001 From: Ross Morsali Date: Thu, 1 Jun 2023 12:06:48 +0200 Subject: [PATCH 3/3] Update packages/components/src/slot-fill/README.md Co-authored-by: Nick Diego --- packages/components/src/slot-fill/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/src/slot-fill/README.md b/packages/components/src/slot-fill/README.md index 6f5f25fe2697bf..ccd4675588c239 100644 --- a/packages/components/src/slot-fill/README.md +++ b/packages/components/src/slot-fill/README.md @@ -91,6 +91,7 @@ const Toolbar = ( { isMobile } ) => ( ``` Props can also be passed from a `Slot` to a `Fill` by using the prop `fillProps` on the `Slot`: + ```jsx const { Fill, Slot } = createSlotFill( 'Toolbar' );