feat(button): add neutral variant to the button directive - #3853
Open
florent-leborgne wants to merge 1 commit into
Open
feat(button): add neutral variant to the button directive#3853florent-leborgne wants to merge 1 commit into
florent-leborgne wants to merge 1 commit into
Conversation
The button directive offered two variants and both were blue. A `secondary` button next to a `primary` one competes for attention. A cluster of peer links had no correct option, because every button claimed to be a call to action. Add `:type: neutral`. It keeps the geometry of the existing variants and changes only the color and the weight. All values come from theme.css, so the change introduces no new tokens. The border uses `grey-70`. That is the lightest grey token that clears the 3:1 non-text contrast ratio in WCAG 1.4.11, at 3.31:1 against white. `grey-60` fails at 2.67:1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
theletterf
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the hub pages thread. Martijn asked for a third button type exposed on the button directive, and Fabri described it as a monochrome secondary button.
Problem
The
{button}directive offers two variants and both are blue.primaryis a filled Elastic blue,secondaryis an Elastic blue outline.When the two sit next to each other, the secondary button competes with the primary for attention. A cluster of peer links has no correct option at all, because every button claims to be a call to action. That is what blocks the hub hero, where several buttons need equal rank.
What this adds
:type: neutral. It keeps the geometry of the existing variants and changes only the color and the weight.#868e9agrey-70border#1c1e23ink-darkfont-medium#1c1e23ink-dark#f6f9fcgrey-10#85b7ffblue-elastic-50Every value comes from
theme.css. The change introduces no new tokens.Height, padding, radius, and font size match
primaryandsecondaryexactly, so a neutral button lines up with its neighbors inside abutton-group. The focus ring stays Elastic blue, so keyboard focus reads the same across all three variants.Two deliberate divergences, please review
These are the parts I'd most like a second opinion on, because they depart from
_LandingPage.cshtml, which is where the existing two styles came from.secondary. A 2px grey border carried too much visual weight for a variant whose job is to recede.Both keep
box-sizing: border-box, so the outer geometry does not change and mixed-variant groups still align.Accessibility
WCAG 1.4.11 asks for 3:1 contrast on the boundary that identifies a control.
grey-70measures 3.31:1 against white and is the lightest grey token that clears it.grey-60fails at 2.67:1. Text contrast measures 16.68:1.Worth flagging for the hub pages stack: the current proof of concept uses
grey-20(1.32:1) andgrey-30(1.63:1) borders. Both fail that threshold and need lifting when they adopt this variant.Out of scope
ink-darkbordered lead action. The hero can pair oneprimarywith severalneutralbuttons instead. Worth revisiting if the all-monochrome hero wins.:tone:property. It doubles the style surface for combinations nobody has asked for yet.Testing
ButtonTests.cscovering the type, the:variant:alias, rendering inside abutton-group, and no diagnostics.dotnet test tests/Elastic.Markdown.Tests/ --filter "FullyQualifiedName~Button"passes 72 tests.npm run buildinsrc/Elastic.Documentation.Siteconfirms every Tailwind utility resolves to a real token.docs/syntax/buttons.mddocuments the variant, so the rendered preview of/syntax/buttonsexercises it.🤖 Generated with Claude Code