Skip to content

feat: add aura-button class to style anchors as buttons#11771

Open
mstahv wants to merge 2 commits into
mainfrom
feature/link-that-looks-like-a-button
Open

feat: add aura-button class to style anchors as buttons#11771
mstahv wants to merge 2 commits into
mainfrom
feature/link-that-looks-like-a-button

Conversation

@mstahv
Copy link
Copy Markdown
Member

@mstahv mstahv commented May 18, 2026

Lets plain elements (typically ) take on the vaadin-button look in the Aura theme by adding the .aura-button class, with theme="primary" and theme="tertiary" variants. Useful when a link needs button styling without losing native anchor behavior (Cmd-click, right-click, etc.).

Minimal version of #1803

Lets plain elements (typically <a>) take on the vaadin-button look in
the Aura theme by adding the .aura-button class, with theme=\"primary\"
and theme=\"tertiary\" variants. Useful when a link needs button styling
without losing native anchor behavior (Cmd-click, right-click, etc.).

Minimal version of #1803"
@mstahv mstahv requested a review from jouni May 18, 2026 18:33
@mstahv
Copy link
Copy Markdown
Member Author

mstahv commented May 18, 2026

@jouni I created a PR with "Kalle" for Aura based on your latest idea in the issue. When waiting for Lumo version, I'm not sure if the "specificatin is right". Now people will need to figure out what theme they are using.

Classname "vaadin-button" or "theme variant" with implenetations in both themes? I'm not a big fan of that Vaadin specific thing that is from my point of view just a weird way to do css class names, but at least it would be unified to other component APIs.

@sonarqubecloud
Copy link
Copy Markdown

@mstahv
Copy link
Copy Markdown
Member Author

mstahv commented May 18, 2026

I was about to take the theme varian route, but apparently Anchor on the Java components would need changes as well 🤷‍♂️ (no theme variants currently for Anchor)

look like a vaadin-button. The corresponding rules for vaadin-button itself are
applied inside its shadow root via the base button styles. See issue #1803.
*/
.aura-button {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thought: this would in theory make it possible to slap .aura-button to any element, which we shouldn't encourage. Should we instead explicitly use a.aura-button to limit this to links?

font-size: var(--vaadin-button-font-size, inherit);
line-height: var(--vaadin-button-line-height, inherit);
font-weight: var(--vaadin-button-font-weight, 500);
color: var(--vaadin-button-text-color, var(--vaadin-text-color));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

note: these properties seem to be copied as is from button base styles. This is problematic as e.g. color is overridden below to var(--vaadin-button-text-color, var(--aura-accent-text-color)) - no need to duplicate it here, same for background. We need to only list what's actually needed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants