You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+73-3
Original file line number
Diff line number
Diff line change
@@ -812,14 +812,84 @@ Fallback markup to render while Clerk is loading. Default: `null`
812
812
813
813
### `<Include />`
814
814
815
-
The `<Include />` component can be used to inject the contents of another MDX file:
815
+
The `<Include />` component can be used to inject the contents of another MDX file. We like to use this component to include partial files that are used in multiple pages. For example, say you have a code example that you'd like to use in multiple pages. You can create a file `code-example.mdx` in the `_partials` folder and then include it in other pages using the `<Include />` component. This way, you write the code example once and only have to maintain it in one place. The `_partials` folder uses Next.js's `_` prefix to ensure that the files are not rendered as pages.
The `<If />` component is used for conditional rendering. When the conditions are true, it displays its contents. When the conditions are false, it hides its contents. We commonly use this component to conditionally render content based on the **active SDK**. The **active SDK** is the SDK that is selected in the sidebar.
826
+
827
+
> [!IMPORTANT]
828
+
> This component cannot be used within code blocks.
|`children`|`React.ReactNode`| The content that will be conditionally rendered. |
833
+
|`condition?` (optional) |`boolean`| The condition that determines if the content is rendered. |
834
+
|`sdk?` (optional) |`string \| string[]`| Filter the content to only display based on the passed SDK(s). For example, if the `sdk` prop is set to `['nextjs', 'react']`, the content will only be rendered if the **active SDK** is Next.js or React. |
<Ifsdk="nextjs">This content will only be rendered if the active SDK is Next.js</If>
868
+
```
869
+
870
+
</details>
871
+
872
+
<details>
873
+
<summary>Filtered to either the Astro or React active SDK</summary>
874
+
875
+
```mdx
876
+
<Ifsdk={['astro', 'react']}>This content will only be rendered if the active SDK is Astro or React</If>
877
+
```
878
+
879
+
</details>
880
+
881
+
<details>
882
+
<summary>Filter within a filter</summary>
883
+
884
+
```mdx
885
+
<Ifsdk={['nextjs', 'remix']}>
886
+
This content will only be rendered if the active SDK is Next.js or Remix.
887
+
<Ifsdk="nextjs">This content will only be rendered if the active SDK is Next.js</If>
888
+
</If>
889
+
```
890
+
891
+
</details>
892
+
823
893
### Images and static assets
824
894
825
895
Images and static assets should be placed in the `public/` folder. To reference an image or asset in content, prefix the path with `/docs`. For example, if an image exists at `public/images/logo.png`, to render it on a page you would use the following: ``.
0 commit comments