diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 8d3c764b41..91968cff8d 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -553,6 +553,10 @@ export namespace Components { * Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. */ "href": string | undefined; + /** + * Set to `"bold"` for a button with vibrant, bold colors or to `"subtle"` for a button with muted, subtle colors. + */ + "hue"?: 'bold' | 'subtle'; /** * The mode determines the platform behaviors of the component. */ @@ -5916,6 +5920,10 @@ declare namespace LocalJSX { * Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. */ "href"?: string | undefined; + /** + * Set to `"bold"` for a button with vibrant, bold colors or to `"subtle"` for a button with muted, subtle colors. + */ + "hue"?: 'bold' | 'subtle'; /** * The mode determines the platform behaviors of the component. */ diff --git a/core/src/components/button/button.ionic.scss b/core/src/components/button/button.ionic.scss index efc4277d84..2650cabdf4 100644 --- a/core/src/components/button/button.ionic.scss +++ b/core/src/components/button/button.ionic.scss @@ -52,6 +52,11 @@ --ripple-color: var(--background-activated); } +:host(.button-solid.button-subtle) { + --background: #{globals.ion-color(primary, subtle)}; + --color: #{globals.ion-color(primary, base)}; +} + // Outline Button // -------------------------------------------------- @@ -81,6 +86,11 @@ // Ripple Effect // ------------------------------------------------------------------------------- +:host(.button-solid.button-subtle.ion-color) .button-native { + background: globals.current-color(subtle); + color: globals.current-color(base); +} + :host(.button-solid.ion-color) ion-ripple-effect { color: globals.current-color(shade); } diff --git a/core/src/components/button/button.tsx b/core/src/components/button/button.tsx index b676026318..b735c7c47b 100644 --- a/core/src/components/button/button.tsx +++ b/core/src/components/button/button.tsx @@ -75,6 +75,12 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf */ @Prop({ reflect: true }) expand?: 'full' | 'block'; + /** + * Set to `"bold"` for a button with vibrant, bold colors or to `"subtle"` for + * a button with muted, subtle colors. + */ + @Prop() hue?: 'bold' | 'subtle' = 'bold'; + /** * Set to `"clear"` for a transparent button that resembles a flat button, to `"outline"` * for a transparent button with a border, or to `"solid"` for a button with a filled background. @@ -349,8 +355,20 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf }; render() { - const { buttonType, type, disabled, rel, target, href, color, expand, hasIconOnly, strong, inheritedAttributes } = - this; + const { + buttonType, + type, + disabled, + rel, + target, + href, + color, + expand, + hue, + hasIconOnly, + strong, + inheritedAttributes, + } = this; const theme = getIonTheme(this); const mode = getIonMode(this); @@ -394,6 +412,7 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf [theme]: true, [buttonType]: true, [`${buttonType}-${expand}`]: expand !== undefined, + [`${buttonType}-${hue}`]: hue !== undefined, [`${buttonType}-${size}`]: size !== undefined, [`${buttonType}-${shape}`]: true, [`${buttonType}-${fill}`]: true, diff --git a/core/src/components/button/test/basic/index.html b/core/src/components/button/test/basic/index.html index 19efe474ce..3976c6abf1 100644 --- a/core/src/components/button/test/basic/index.html +++ b/core/src/components/button/test/basic/index.html @@ -12,6 +12,12 @@ + +
@@ -23,6 +29,8 @@
-
-
-
-
+
+
+
+
+
+