If
The <If> component lets you show or hide content based on which instance, product, or version the reader is viewing, or their role if your docs use authentication.
Variants
By instance
Use the instance prop to show content only when the reader is viewing a specific instance. The values in the instance array correspond to the instance names defined in your docs.yml.
By product
Use the products prop to show content only when the reader is viewing a specific product. The values in the products array correspond to the product slugs defined in your docs.yml.
By version
Use the versions prop to show content only when the reader is viewing a specific version. The values in the versions array correspond to the version slugs defined in your docs.yml.
By role
Use the roles prop to show content based on the role of an authenticated user. The values in the roles array correspond to the roles defined in your role-based access control configuration.
Combining conditions
You can combine products, versions, and roles props on a single <If> component. When multiple props are specified, all conditions must match.
Inverting conditions
Use the not prop to invert any condition, showing content when the condition doesn’t match.
Properties
Show content only when the reader is viewing one of the specified instances. Values correspond to instance names defined in your docs.yml.
Show content only when the reader is viewing one of the specified products. Values correspond to product slugs defined in your docs.yml.
Show content only when the reader is viewing one of the specified versions. Values correspond to version slugs defined in your docs.yml.
Show content only when the authenticated user has one of the specified roles.
Invert the condition, showing content when the condition doesn’t match.
The content to show or hide based on the condition.