Skip to content

Conversation

@theletterf
Copy link
Contributor

@theletterf theletterf commented Dec 16, 2025

Adds a new {button} directive for creating styled call-to-action buttons in documentation.

Fixes #2373

Features

  • Two button types: primary (filled) and secondary (outlined)
  • Button groups: Multiple buttons in a row with {button-group}
  • Alignment options: left, center, right for standalone buttons and groups
  • Link support: Internal paths, external URLs, and cross-repository links
  • External link handling: Auto-detection for non-elastic.co URLs with target="_blank" and security attributes

Syntax

:::{button} Get Started
:link: /get-started
:type: primary
:::

::::{button-group}
:::{button} Primary
:link: docs-content://get-started/introduction.md
:::
:::{button} Secondary
:link: /other-page
:type: secondary
:::
::::

Changes

  • New directive classes: ButtonBlock, ButtonGroupBlock
  • Razor views for rendering
  • CSS styles matching elastic.co/docs landing page buttons
  • Unit tests for parsing, validation, and rendering
  • Documentation at docs/syntax/buttons.md

Note

This PR was developed with AI assistance (Claude Opus 4.5 in Cursor 2).

@theletterf theletterf self-assigned this Dec 16, 2025
@theletterf theletterf requested review from a team as code owners December 16, 2025 11:44
@theletterf theletterf requested a review from cotti December 16, 2025 11:44
@github-actions
Copy link

github-actions bot commented Dec 16, 2025

🔍 Preview links for changed docs

Copy link
Member

@reakaleek reakaleek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Do you have any thoughts on this @itsalexcm?

@theletterf theletterf marked this pull request as draft December 17, 2025 15:49
@itsalexcm
Copy link
Contributor

Looks good to me too. I’m wondering if there’s any specific reason to use outlined buttons instead of the non-filled primary button, even though I like the outlined ones.

Button

@theletterf
Copy link
Contributor Author

@itsalexcm Thanks! I would guess it's for conveying a secondary or optional action, like we do in the homepage of our docs.

@theletterf theletterf marked this pull request as ready for review December 18, 2025 11:02
@itsalexcm
Copy link
Contributor

@theletterf Fair enough. I think that in the product we usually use the outlined button to highlight or frame actions (e.g. headers, marketing contexts), while standard secondary actions typically use the defined non-filled primary button style.

That said, I’m fine with the outlined button for now. We can revisit and align this later if needed. Good job!

@theletterf theletterf merged commit 5ffe42b into main Dec 18, 2025
29 checks passed
@theletterf theletterf deleted the button-directive branch December 18, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Button directive

4 participants