1818You can find the docs on the
1919[ docs website] ( https://react-slots-docs.vercel.app/ )
2020
21- ## Simple Example: Implementing
21+ ## Implementing
2222
23- ``` jsx
23+ ``` tsx
2424import { useSlot , SlotChildren , Slot } from " @beqa/react-slots" ;
2525
2626type ListItemProps = {
2727 children: SlotChildren <
28- | Slot< " title" > // Shorthand of Slot<"title", {}>
29- | Slot< " thumbnail" > // Shorthand of Slot<"thumbnail", {}>
30- | Slot< { isExpanded: boolean }> // Shorthand of Slot<"default", {isExpanded: boolean}>
31- > ;
32- }
28+ | Slot <" title" > // Shorthand of Slot<"title", {}>
29+ | Slot <" thumbnail" > // Shorthand of Slot<"thumbnail", {}>
30+ | Slot <{ isExpanded: boolean }> // Shorthand of Slot<"default", {isExpanded: boolean}>
31+ >;
32+ };
3333
3434function ListItem({ children }: ListItemProps ) {
3535 const { slot } = useSlot (children );
@@ -53,9 +53,9 @@ function ListItem({ children }: ListItemProps) {
5353}
5454```
5555
56- ## Simple Example: Specifying Slot Content From the Parent
56+ ## Specifying Slot Content From the Parent
5757
58- ### With ` slot-name ` Attribute
58+ With ` slot-name ` attribute
5959
6060``` jsx
6161< ListItem>
@@ -65,7 +65,7 @@ function ListItem({ children }: ListItemProps) {
6565< / ListItem>
6666```
6767
68- ### With Templates
68+ With Templates
6969
7070``` jsx
7171import { template } from " beqa/react-slots" ;
@@ -84,7 +84,7 @@ import { template } from "beqa/react-slots";
8484</ListItem>;
8585```
8686
87- ### With Type -safe Templates
87+ With type -safe templates
8888
8989```tsx
9090// Option #1
@@ -115,7 +115,7 @@ const template = template as CreateTemplate<ListItemProps["children"]>;
115115| The code samples below represent actual implementations. No need to define external state or event handlers for these components to function . |
116116| --------------------------------------------------------------------------------------------------------------------------------------------- |
117117
118- #### Creating highly composable `Accordion` and `AccordionList` components using react-slots
118+ ### Creating highly composable `Accordion` and `AccordionList` components using react-slots
119119
120120Checkout
121121[live example](https : // stackblitz.com/edit/stackblitz-starters-tq32ef?file=pages%2Findex.tsx)
@@ -137,7 +137,7 @@ Checkout
137137</AccordionList>
138138` ` `
139139
140- #### Creating highly composable ` Dialog` and ` DialogTrigger` components using react - slots
140+ ### Creating highly composable ` Dialog` and ` DialogTrigger` components using react - slots
141141
142142Checkout
143143[live example ](https: // stackblitz.com/edit/stackblitz-starters-fa5wbe?file=pages%2Findex.tsx)
0 commit comments