---
title: "Conditional rendering"
subtitle: "<If> (alias <Conditional>) renders content only for certain languages, versions or products."
---

Renders its children only for the current page's locale, version, or product (alias `<Conditional>`), without adding any wrapper element:

```mdx
<If locales={["zh"]}>Only on Chinese pages.</If>
<If locales={["en"]}>Only on English pages.</If>
<If versions={["v0"]}>Only in v0.</If>
<If products={["sdk"]} not>Everywhere except the SDK product.</If>
```

<If locales={["zh"]}>
  <Tip>这条提示只在中文页面显示。</Tip>
</If>

<If locales={["en"]}>
  <Tip>This tip only appears on English pages.</Tip>
</If>

<ParamField path="locales" type="string[]">Locale codes (`languages` and `lang` also work).</ParamField>
<ParamField path="versions" type="string[]">Version ids, slugs, or display names.</ParamField>
<ParamField path="products" type="string[]">Product ids, slugs, or display names.</ParamField>
<ParamField path="not" type="boolean" default="false">Negate the condition.</ParamField>
<ParamField path="roles" type="string[]">Show content by reader role. Static builds have no logged-in user, so it never matches.</ParamField>

When multiple conditions are set, all of them must match.
