File tree Expand file tree Collapse file tree 3 files changed +51
-81
lines changed
pages/component-library/custom-components Expand file tree Collapse file tree 3 files changed +51
-81
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,9 @@ navigation:
7979 path : ./pages/component-library/custom-components/reusable-markdown.mdx
8080 - page : Custom React Components
8181 path : ./pages/component-library/custom-components/custom-react-components.mdx
82- - page : Global Variables
82+ - page : Conditionally Rendered Content
8383 hidden : true
84- path : ./pages/component-library/custom-components/global-variables .mdx
84+ path : ./pages/component-library/custom-components/conditional-rendering .mdx
8585 - section : Customization
8686 collapsed : true
8787 contents :
Original file line number Diff line number Diff line change 1+ ---
2+ title : Conditionally Rendered Content
3+ ---
4+
5+ You can conditionally render content based on the instance or version of the docs, in addition to the role of an authenticated user.
6+
7+ ## Conditionally render content
8+
9+ ### Between instances
10+
11+ Define instances in your ` docs.yml ` file:
12+
13+ ``` yaml docs.yml
14+ instances :
15+ - url : fern-dev.docs.buildwithfern.com
16+ name : development
17+ - url : fern-prod.docs.buildwithfern.com
18+ name : production
19+ ` ` `
20+
21+ ` ` ` mdx conditional-rendering.mdx
22+ <If instance={["development"]}>
23+ This is a beta feature. It should only be available when the docs have been generated with the `development` instance.
24+ </If>
25+
26+ <If instance={["production"]}>
27+ This is a production feature. It should only be available when the docs have been generated with the `production` instance.
28+ </If>
29+ ```
30+
31+ ### Between versions
32+
33+ ``` mdx conditional-rendering.mdx
34+ <If version = { [" v1" ]} >
35+ This is an old feature. It should only be available when the user is on the ` v1 ` version.
36+ </If >
37+
38+ <If version = { [" v2" ]} >
39+ This is a new feature. It should only be available when the user is on the ` v2 ` version.
40+ </If >
41+ ```
42+
43+ ### Based on the role of an authenticated user
44+
45+ ``` mdx conditional-rendering.mdx
46+ <If viewer = { [" admin" ]} >
47+ This is an admin feature. It should only be available when the user is an admin.
48+ </If >
49+ ```
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments