For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Book a demoLog inStart for free
  • Getting started
    • Overview
    • How it works
    • Quickstart
    • Project structure
    • Customer showcase
    • Changelog
  • Configuration
    • Overview
    • Site-level settings
    • Page-level settings
  • Writing content
    • Markdown basics
    • Rich media in Markdown
      • Overview
      • Accordion
      • Anchor
      • Aside
      • Badge
      • Button
      • Callout
      • Card
      • Code block
      • Copy
      • Download
      • Endpoint request snippet
      • Endpoint response snippet
      • Endpoint schema snippet
      • Webhook payload snippet
      • Files
      • Frame
      • Icon
      • If
      • Indent
      • Parameter field
      • Prompt
      • Runnable endpoint
      • Schema
      • Step
      • Table
      • Tab
      • Tooltip
      • Versions
    • Fern Editor
    • Reusable snippets
  • AI features
    • Overview
    • Fern Writer
    • AI-generated examples
    • Markdown access
      • Overview
      • Customize LLM output
      • Agent directives
      • Analytics and integration
    • MCP server
    • API catalog discovery
  • Public API
    • GETJWT from Fern API key
    • GETAlgolia search credentials
    • GETCurrent user information
  • Fern Writer API
    • GETGet Fern Writer Install Link
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
Book a demoLog inStart for free
On this page
  • Variants
  • By product
  • By version
  • By role
  • Combining conditions
  • Inverting conditions
  • Properties
Writing contentComponents

If

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Icon

Next

Indent

The <If> component lets you show or hide content based on which product or version the reader is viewing, or their role if your docs use authentication.

Variants

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.

Markdown
1<If products={["orchids"]}>
2 This content only appears when viewing the orchids product.
3</If>
4
5<If products={["orchids", "succulents"]}>
6 This content appears in both the orchids and succulents products.
7</If>

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.

Markdown
1<If versions={["v1"]}>
2 This content only appears in version v1.
3</If>
4
5<If versions={["v2"]}>
6 This content only appears in version v2.
7</If>

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.

Markdown
1<If roles={["admin"]}>
2 This content is only visible to admins.
3</If>

Combining conditions

You can combine products, versions, and roles props on a single <If> component. When multiple props are specified, all conditions must match.

Markdown
1<If products={["orchids"]} versions={["v2"]}>
2 This content only appears in the orchids product when viewing version v2.
3</If>
4
5<If products={["succulents"]} roles={["beta-users"]}>
6 This content only appears in the succulents product for beta users.
7</If>

Inverting conditions

Use the not prop to invert any condition, showing content when the condition doesn’t match.

Markdown
1<If products={["legacy"]} not>
2 This content appears in every product except legacy.
3</If>
4
5<If versions={["v1"]} not>
6 This content appears in every version except v1.
7</If>

Properties

products
string[]

Show content only when the reader is viewing one of the specified products. Values correspond to product slugs defined in your docs.yml.

versions
string[]

Show content only when the reader is viewing one of the specified versions. Values correspond to version slugs defined in your docs.yml.

roles
string[]

Show content only when the authenticated user has one of the specified roles.

not
booleanDefaults to false

Invert the condition, showing content when the condition doesn’t match.

children
string | JSXRequired

The content to show or hide based on the condition.