Skip to content

Support applies_to in additional directives/components #1436

@bmorelli25

Description

@bmorelli25

Summary

Add custom support for applies_to tags in the following components:

  • Tabs
  • Dropdowns
  • Admonitions

Tabs

Automatically convert a single applies_to badge into a tab title, so users can immediately see which version or platform each tab applies to without expanding it.

Behavior

If the applies_to: prop is not null:

  • Set the applies_to text as the tab title
  • Add the applies_to badge to the top of the tab content
  • Error if a tab title exists

Limitations

  • Multiple applies_to tags per tab not supported as tab titles would get too long
  • This is a short term fix. Some tabs will need need applies_to tab sections each release which would lead to way too many tabs in the widget.

Syntax

::::{tab-set}
:::{tab-item}
applies_to: stack: beta 9.0`
This is where the content for tab #1 goes.
:::
:::{tab-item}
applies_to: stack: ga 9.1`
This is where the content for tab #2 goes.
:::
:::{tab-item}
applies_to: serverless: ga
This is where the content for tab #3 goes.
:::
::::

Output

Image Image

Drop downs

Make version/platform context visible in dropdown titles so users can make informed choices before expanding the content.

Behavior

If the applies_to: prop is not null:

  • Prepend the text of the applies_to badge to the dropdown title
  • Add the applies_to badge to the top of the dropdown content

Limitations

  • Multiple applies_to tags per dropdown not supported as titles would get too long

Syntax

:::{dropdown} Rules are failing due to number of alerts
applies_to: stack: all
Dropdown content
:::
:::{dropdown} Rules are failing due to number of alerts
applies_to: eck: all
Dropdown content
:::

Output

Image

Admonitions

Allow authors to add applies_to badges to admonitions so users can quickly identify whether the content is relevant to their deployment environment. Admonitions are a little different from tabs and dropdowns as all context is available to the user without having to click on anything.

Behavior

If the applies_to: prop is not null:

  • Add an applies_to badge to the beginning of the admonition
  • If type is {admonition}, only add an applies_to badge to the admonition heading. Any regular admonition with applies_to prop info should error.

Syntax

:::{tip}
applies_to: eck: all
This is a tip.
:::

:::{admonition}
applies_to: stack: 9.1
Dense vector fields are always indexed as `int8_hnsw`.
:::

Output

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions