diff --git a/core/api.txt b/core/api.txt index 3db9b064b25..13ed1d71157 100644 --- a/core/api.txt +++ b/core/api.txt @@ -390,6 +390,7 @@ ion-button,prop,expand,"block" | "full" | undefined,undefined,false,true ion-button,prop,fill,"clear" | "default" | "outline" | "solid" | undefined,undefined,false,true ion-button,prop,form,HTMLFormElement | string | undefined,undefined,false,false ion-button,prop,href,string | undefined,undefined,false,false +ion-button,prop,hue,"bold" | "subtle" | undefined,'bold',false,false ion-button,prop,mode,"ios" | "md",undefined,false,false ion-button,prop,rel,string | undefined,undefined,false,false ion-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 1ce0b2fba36..afe452f461d 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -562,6 +562,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. */ @@ -6019,6 +6023,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 93ccbbde884..b4fabe670d9 100644 --- a/core/src/components/button/button.ionic.scss +++ b/core/src/components/button/button.ionic.scss @@ -52,6 +52,12 @@ --ripple-color: var(--background-activated); } +:host(.button-solid.button-subtle) { + --background: #{globals.ion-color(primary, base, $subtle: true)}; + --background-activated: #{globals.ion-color(primary, shade, $subtle: true)}; + --color: #{globals.ion-color(primary, contrast, $subtle: true)}; +} + // Outline Button // -------------------------------------------------- @@ -81,6 +87,19 @@ // Ripple Effect // ------------------------------------------------------------------------------- +:host(.button-solid.button-subtle.ion-color) .button-native { + background: globals.current-color(base, $subtle: true); + color: globals.current-color(contrast, $subtle: true); +} + +:host(.button-solid.button-subtle.ion-color.ion-activated) .button-native::after { + background: globals.current-color(shade, $subtle: true); +} + +:host(.button-solid.button-subtle.ion-color.ion-focused) .button-native::after { + background: globals.current-color(tint, $subtle: true); +} + :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 b6760263188..b735c7c47b5 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 19efe474cea..4f1283d5f81 100644 --- a/core/src/components/button/test/basic/index.html +++ b/core/src/components/button/test/basic/index.html @@ -12,6 +12,17 @@ + + @@ -23,108 +34,136 @@ -

- Default - Default.focused - Default.activated -

- -

- Primary - Primary.focused - Primary.activated -

- -

- Secondary - Secondary.focused - Secondary.activated -

- -

- Tertiary - Tertiary.focused - Tertiary.activated -

- -

- Success - Success.focused - Success.activated -

- -

- Warning - Warning.focused - Warning.activated -

- -

- Danger - Danger.focused - Danger.activated -

- -

- Light - Light.focused - Light.activated -

- -

- Medium - Medium.focused - Medium.activated -

- -

- Dark - Dark.focused - Dark.activated -

- -

- Opacity: 0.2 -

- -

- Button Disabled - Secondary Disabled - Disabled opacity: 1 -

- -

- Toggle Disabled -

- -

- Change Color - Change Color -

+
+
+

Bold (default) Buttons

+ +

+ Default + Default.focused + Default.activated +

+ +

+ Primary + Primary.focused + Primary.activated +

+ +

+ Secondary + Secondary.focused + Secondary.activated +

+ +

+ Tertiary + Tertiary.focused + Tertiary.activated +

+ +

+ Success + Success.focused + Success.activated +

+ +

+ Warning + Warning.focused + Warning.activated +

+ +

+ Danger + Danger.focused + Danger.activated +

+ +

+ Light + Light.focused + Light.activated +

+ +

+ Medium + Medium.focused + Medium.activated +

+ +

+ Dark + Dark.focused + Dark.activated +

+
+ +
+

Subtle Buttons

+ +

+ Default + Default.focused + Default.activated +

+ +

+ Primary + Primary.focused + Primary.activated +

+ +

+ Secondary + Secondary.focused + Secondary.activated +

+ +

+ Tertiary + Tertiary.focused + Tertiary.activated +

+ +

+ Success + Success.focused + Success.activated +

+ +

+ Warning + Warning.focused + Warning.activated +

+ +

+ Danger + Danger.focused + Danger.activated +

+ +

+ Light + Light.focused + Light.activated +

+ +

+ Medium + Medium.focused + Medium.activated +

+ +

+ Dark + Dark.focused + Dark.activated +

+
+
- - diff --git a/packages/angular/src/directives/proxies.ts b/packages/angular/src/directives/proxies.ts index 7aabf55c70a..2ccd8da6ce2 100644 --- a/packages/angular/src/directives/proxies.ts +++ b/packages/angular/src/directives/proxies.ts @@ -345,14 +345,14 @@ export declare interface IonBreadcrumbs extends Components.IonBreadcrumbs { @ProxyCmp({ - inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'] + inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'hue', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'] }) @Component({ selector: 'ion-button', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'], + inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'hue', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'], }) export class IonButton { protected el: HTMLIonButtonElement; diff --git a/packages/angular/standalone/src/directives/proxies.ts b/packages/angular/standalone/src/directives/proxies.ts index 532da1596ec..775af3f12d2 100644 --- a/packages/angular/standalone/src/directives/proxies.ts +++ b/packages/angular/standalone/src/directives/proxies.ts @@ -440,14 +440,14 @@ export declare interface IonBreadcrumbs extends Components.IonBreadcrumbs { @ProxyCmp({ defineCustomElementFn: defineIonButton, - inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'] + inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'hue', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'] }) @Component({ selector: 'ion-button', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'], + inputs: ['buttonType', 'color', 'disabled', 'download', 'expand', 'fill', 'form', 'href', 'hue', 'mode', 'rel', 'routerAnimation', 'routerDirection', 'shape', 'size', 'strong', 'target', 'theme', 'type'], standalone: true }) export class IonButton { diff --git a/packages/vue/src/proxies.ts b/packages/vue/src/proxies.ts index 48c3a2444ef..7b0815cd378 100644 --- a/packages/vue/src/proxies.ts +++ b/packages/vue/src/proxies.ts @@ -176,6 +176,7 @@ export const IonButton: StencilVueComponent = /*@__PURE__*/ defin 'buttonType', 'disabled', 'expand', + 'hue', 'fill', 'routerDirection', 'routerAnimation',