Skip to content

Support applies_to in additional directives/components #1436

Closed

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

Activity

  1. reakaleek commented on Jul 3, 2025

    @reakaleek
    Member

    Is this already done by #1487?

  2. bmorelli25 commented on Jul 10, 2025

    @bmorelli25
    MemberAuthor

    @KOTungseth do we have design on this yet?

  3. KOTungseth commented on Jul 12, 2025

    @KOTungseth
    Contributor

    Casper is working on the designs, but has been unable to dedicate the time. His plan is to share what he has next week, but if he's unable to, he'll assign someone else.

  4. colleenmcginnis commented on Aug 5, 2025

    @colleenmcginnis
    Contributor

    Does this have to be blocked by design? Can we move forward with this and refine the design later like we talked about a couple weeks ago? Writers are starting to feel the pain of not having these available.

  5. reakaleek commented on Aug 6, 2025

    @reakaleek
    Member

    I guess we can. How do you imagine this to be displayed for tabs, annotations (what are annotations?) and bullet lists?

    Does the inline syntax already suffice for this?

  6. bmorelli25 commented on Aug 6, 2025

    @bmorelli25
    MemberAuthor

    I updated the description of this issue with a starting point for how to handle applies_to in the context of tabs, dropdowns, and admonitions. I'll post in #docs-team for feedback.

  7. eedugon commented on Aug 7, 2025

    @eedugon
    Contributor

    should we consider also stepper in case certain steps of a process are applicable only for certain deployment types?
    just to ensure we don't forget about that component ;)

  8. shainaraskas commented on Aug 7, 2025

    @shainaraskas
    Member

    @bmorelli25 I think we have a common use case where an annotation is provided specifically to provide version info, so we would want an experience closer to the tabs or dropdowns in that case.

  9. bmorelli25 commented on Aug 7, 2025

    @bmorelli25
    MemberAuthor

    should we consider also stepper in case certain steps of a process are applicable only for certain deployment types?

    Good callout. We might be able to survive with tabs nested within a step for now. The problem with all of the solutions above is that they don't scale as we add more and more version differences with new releases. So it might make sense to wait on stepper until we have a better long-term vision for these components

  10. bmorelli25 commented on Aug 19, 2025

    @bmorelli25
    MemberAuthor

    A potential case for a version-system-aware code block was discussed on Slack today.

    This could be a way to show runnable commands/snippets that change based on the selected product version (e.g., 9.0 vs 9.1), without forcing authors to duplicate content.

    Goals

    • Keep authoring simple.
    • Let users switch versions in-place and see the command update immediately.
    • Specify the selected version in syntax.
    • Make “Copy” use the currently selected version.
    • Remember selected version across all instances of versioned code blocks

    Potential implementation

    ```sh version.stack=true
    docker pull docker.elastic.co/elasticsearch/elasticsearch:{{version.stack}}
    ```
    

    Potential user experience
    (Option A) A code block with a "change version" button or dropdown that allows them to change the version of the copyable code snippet.
    (Option B) Exactly what @shainaraskas suggests in the Slack thread linked above (tabs that allow you to choose between current and a specific version).


    Kinda related to this issue: https://github.com/elastic/docs-content-internal/issues/205

  11. colleenmcginnis commented on Sep 3, 2025

    @colleenmcginnis
    Contributor

    @Mpdreamz here are some examples of existing pages using tabs to communicate the kinds of things applies_to includes:

    Versions:

    Deployment types:

    Serverless/stateful:

    Latest/specific version:

    EDOT / APM Agent:

  12. Mpdreamz commented on Sep 3, 2025

    @Mpdreamz
    Member

    @bmorelli25 @siamakp-elastic @colleenmcginnis What about using the following syntax?

    ::::{apply-switch}
    :::{applies_to} stack: beta 9.0
    This is where the content for tab #1 goes.
    :::
    :::{applies_to}`stack: ga 9.1`
    This is where the content for tab #2 goes.
    :::
    :::{applies_to} `serverless: ga`
    This is where the content for tab #3 goes. The backticks will be stripped and are optional but gives them parity with the applies to role.
    :::
    ::::

    This new directive would still render as tabs but would allow us to move it to a different rendering later without having to coordinate file source changes.

  13. colleenmcginnis commented on Sep 3, 2025

    @colleenmcginnis
    Contributor

    I could get on board with this. I wonder if the subitem directive should have a unique name — in other words, not applies_to, which accepts the applicability data in the body in other contexts instead of text (though I think only when using ``` instead of :::).

  14. reakaleek commented on Sep 9, 2025

    @reakaleek
    Member

    @siamakp-elastic do you have an update?

  15. changed the issue type fromtoon Sep 15, 2025
  16. self-assigned this
    on Sep 22, 2025
  17. reakaleek commented on Sep 23, 2025

    @reakaleek
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions