-
Notifications
You must be signed in to change notification settings - Fork 37
feat(button): adopt outline flat style as the default look #2746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,6 +95,11 @@ | |
| $bg: var(--color-background-#{$color}); | ||
| $fg: var(--color-foreground-#{$color}); | ||
|
|
||
| // Stable per-colour accent, immune to the hover fg/bg var-swap. | ||
| :global(#{$base}[data-color=#{$color}]) { | ||
| --accent-action-button: #{$bg}; | ||
| } | ||
|
|
||
| @include variant-styles($base, $color, primary, $bg, $fg); | ||
| @include variant-styles($base, $color, secondary, $fg, $bg); | ||
|
|
||
|
|
@@ -145,7 +150,7 @@ | |
| align-items: center; | ||
| flex-shrink: 0; | ||
|
|
||
| border-radius: var(--border-radius-m); | ||
| border-radius: var(--border-radius-l); | ||
| background-color: var(--color-background-action-button); | ||
| color: var(--color-foreground-action-button); | ||
|
|
||
|
|
@@ -177,18 +182,42 @@ | |
| display: none; | ||
| } | ||
|
|
||
| // Flat is an outline matching the labelled buttons: accent ring + accent | ||
| // icon, primary heavier than secondary, colour-shift hover, no glow. | ||
| :global(#{$b}[data-style=flat][data-variant=primary]#{$on}) { | ||
| background-color: color-mix(in srgb, var(--accent-action-button) 14%, transparent); | ||
| color: var(--accent-action-button); | ||
| border: var(--border-thickness-xs) solid | ||
| color-mix(in srgb, var(--accent-action-button) 65%, transparent); | ||
| } | ||
|
Comment on lines
+190
to
+192
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the new flat style introduces an outline border whose color changes on hover and active states, Please update the base transition-property:
background-color, color, border-color, box-shadow, transform, outline, outline-offset;
Comment on lines
+185
to
+192
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the new |
||
|
|
||
| :global(#{$b}[data-style=flat][data-variant=secondary]#{$on}) { | ||
| background-color: transparent; | ||
| color: var(--accent-action-button); | ||
| border: var(--border-thickness-xxs) solid | ||
| color-mix(in srgb, var(--accent-action-button) 30%, transparent); | ||
| } | ||
|
|
||
| @include for-mouse { | ||
| :global(#{$b}:hover#{$on}) { | ||
| box-shadow: 0 var(--ni-2) var(--ni-8) var(--ni-neg-2) | ||
| color-mix( | ||
| in srgb, | ||
| var(--color-background-action-button) 50%, | ||
| transparent | ||
| ); | ||
| :global(#{$b}[data-style=flat][data-variant=primary]:hover#{$on}) { | ||
| background-color: color-mix(in srgb, var(--accent-action-button) 26%, transparent); | ||
| border-color: color-mix(in srgb, var(--accent-action-button) 95%, transparent); | ||
| } | ||
|
|
||
| :global(#{$b}[data-style=flat][data-variant=secondary]:hover#{$on}) { | ||
| background-color: color-mix(in srgb, var(--accent-action-button) 16%, transparent); | ||
| border-color: color-mix(in srgb, var(--accent-action-button) 60%, transparent); | ||
| } | ||
| } | ||
|
|
||
| :global(#{$b}:active#{$on}) { | ||
| :global(#{$b}[data-style=flat]:active#{$on}) { | ||
| transform: scale(0.92); | ||
| background-color: color-mix(in srgb, var(--accent-action-button) 36%, transparent); | ||
| border-color: var(--accent-action-button); | ||
| box-shadow: none; | ||
| } | ||
|
|
||
| :global(#{$b}[data-style=ghost]:active#{$on}) { | ||
| transform: scale(0.92); | ||
| box-shadow: none; | ||
| } | ||
|
|
@@ -208,28 +237,6 @@ | |
| margin: var(--ni-4); | ||
| } | ||
|
|
||
| :global(#{$b}[data-variant=secondary]:not([data-style=ghost])#{$on}) { | ||
| background-color: color-mix( | ||
| in srgb, | ||
| var(--color-foreground-action-button) 5%, | ||
| transparent | ||
| ); | ||
| border: var(--border-thickness-xxs) solid | ||
| color-mix( | ||
| in srgb, | ||
| var(--color-foreground-action-button) 50%, | ||
| transparent | ||
| ); | ||
| color: var(--color-text-primary); | ||
| } | ||
|
|
||
| @include for-mouse { | ||
| :global(#{$b}[data-variant=secondary]:not([data-style=ghost])#{$on}:hover) { | ||
| background-color: var(--color-background-action-button); | ||
| color: var(--color-foreground-action-button); | ||
| } | ||
| } | ||
|
|
||
| :global(#{$b}[data-style=ghost]) { | ||
| background-color: transparent; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,12 @@ | |
| $bg: var(--color-background-#{$color}); | ||
| $fg: var(--color-foreground-#{$color}); | ||
|
|
||
| // Stable per-colour accent, immune to the hover fg/bg var-swap below. | ||
| // The outline flat style leans on this so its ring/text stay the accent. | ||
| :global(#{$base}[data-color=#{$color}]) { | ||
| --accent-button: #{$bg}; | ||
| } | ||
|
|
||
| @include variant-styles($base, $color, primary, $bg, $fg); | ||
| @include variant-styles($base, $color, secondary, $fg, $bg); | ||
|
|
||
|
|
@@ -251,7 +257,7 @@ | |
| :global(#{$b}:active[disabled]) { | ||
| height: var(--button-height); | ||
| box-sizing: border-box; | ||
| border-radius: var(--border-radius-m); | ||
| border-radius: var(--border-radius-l); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default button radius has been updated to To maintain visual consistency across all button sizes under the new design language, please update the small button's border-radius around line 239 to scale from border-radius: calc(var(--border-radius-l) * 0.8); |
||
| } | ||
|
|
||
| :global(#{$b}::before) { | ||
|
|
@@ -344,16 +350,39 @@ | |
| outline: var(--border-thickness-xxs) solid var(--color-foreground); | ||
| } | ||
|
|
||
| // Flat is an outline: no heavy fill, accent ring + accent text. Primary | ||
| // leans heavier (thicker ring + a tint of fill); secondary is a quiet | ||
| // hairline ring. Hover/press are pure colour shifts - no lift, no glow. | ||
| :global(#{$b}[data-style=flat][data-variant=primary]#{$on}) { | ||
| background: color-mix(in srgb, var(--accent-button) 14%, transparent); | ||
| color: var(--accent-button); | ||
| border: var(--border-thickness-xs) solid | ||
| color-mix(in srgb, var(--accent-button) 65%, transparent); | ||
| } | ||
|
Comment on lines
+353
to
+361
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the flat button style now introduces a border, the border color changes on hover and active states. However, We should override the
Comment on lines
+359
to
+361
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the action button, the new flat style introduces an outline border whose color changes on hover and active states. Since Please update the base transition-property:
box-shadow, outline, outline-offset, padding, transform, color,
background, border-color, text-decoration;
Comment on lines
+353
to
+361
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the new |
||
|
|
||
| :global(#{$b}[data-style=flat][data-variant=secondary]#{$on}) { | ||
| background: transparent; | ||
| color: var(--accent-button); | ||
| border: var(--border-thickness-xxs) solid | ||
| color-mix(in srgb, var(--accent-button) 30%, transparent); | ||
| } | ||
|
|
||
| @include for-mouse { | ||
| :global(#{$b}[data-style=flat]:hover#{$on}) { | ||
| box-shadow: 0 var(--ni-4) var(--ni-12) var(--ni-neg-2) | ||
| color-mix(in srgb, var(--color-background-button) 45%, transparent); | ||
| transform: translateY(calc(var(--ni-1) * -1)); | ||
| :global(#{$b}[data-style=flat][data-variant=primary]:hover#{$on}) { | ||
| background: color-mix(in srgb, var(--accent-button) 26%, transparent); | ||
| border-color: color-mix(in srgb, var(--accent-button) 95%, transparent); | ||
| } | ||
|
|
||
| :global(#{$b}[data-style=flat][data-variant=secondary]:hover#{$on}) { | ||
| background: color-mix(in srgb, var(--accent-button) 16%, transparent); | ||
| border-color: color-mix(in srgb, var(--accent-button) 60%, transparent); | ||
| } | ||
| } | ||
|
|
||
| :global(#{$b}[data-style=flat]:active#{$on}) { | ||
| transform: scale(calc(var(--scale-factor-button) * 0.97)); | ||
| background: color-mix(in srgb, var(--accent-button) 36%, transparent); | ||
| border-color: var(--accent-button); | ||
| box-shadow: none; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the labelled buttons, the flat action button style now introduces a border. Since
border-coloris not included in the base transition properties of the action button, the border color changes will snap instantly on hover and active states.We should override the
transition-propertyfor flat action buttons to includeborder-colorto ensure smooth transitions.