diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts
index 53212778126..77bf3e51f62 100755
--- a/src/app/components/button/button.ts
+++ b/src/app/components/button/button.ts
@@ -16,7 +16,8 @@ import {
QueryList,
TemplateRef,
ViewEncapsulation,
- booleanAttribute
+ booleanAttribute,
+ numberAttribute
} from '@angular/core';
import { PrimeTemplate, SharedModule } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
@@ -101,6 +102,41 @@ export class ButtonDirective implements AfterViewInit, OnDestroy {
this.setStyleClass();
}
}
+ /**
+ * Defines the style of the button.
+ * @group Props
+ */
+ @Input() severity: 'success' | 'info' | 'warning' | 'danger' | 'help' | 'primary' | 'secondary' | 'contrast' | null | undefined;
+ /**
+ * Add a shadow to indicate elevation.
+ * @group Props
+ */
+ @Input({ transform: booleanAttribute }) raised: boolean = false;
+ /**
+ * Add a circular border radius to the button.
+ * @group Props
+ */
+ @Input({ transform: booleanAttribute }) rounded: boolean = false;
+ /**
+ * Add a textual class to the button without a background initially.
+ * @group Props
+ */
+ @Input({ transform: booleanAttribute }) text: boolean = false;
+ /**
+ * Add a border class without a background initially.
+ * @group Props
+ */
+ @Input({ transform: booleanAttribute }) outlined: boolean = false;
+ /**
+ * Defines the size of the button.
+ * @group Props
+ */
+ @Input() size: 'small' | 'large' | undefined | null = null;
+ /**
+ * Add a plain textual class to the button without a background initially.
+ * @group Props
+ */
+ @Input({ transform: booleanAttribute }) plain: boolean = false;
public _label: string | undefined;
@@ -160,6 +196,42 @@ export class ButtonDirective implements AfterViewInit, OnDestroy {
}
}
+ if (this.text) {
+ styleClass.push('p-button-text');
+ }
+
+ if (this.severity) {
+ styleClass.push(`p-button-${this.severity}`);
+ }
+
+ if (this.plain) {
+ styleClass.push('p-button-plain');
+ }
+
+ if (this.raised) {
+ styleClass.push('p-button-raised');
+ }
+
+ if (this.size) {
+ styleClass.push(`p-button-${this.size}`);
+ }
+
+ if (this.outlined) {
+ styleClass.push('p-button-outlined');
+ }
+
+ if (this.rounded) {
+ styleClass.push('p-button-rounded');
+ }
+
+ if (this.size === 'small') {
+ styleClass.push('p-button-sm');
+ }
+
+ if (this.size === 'large') {
+ styleClass.push('p-button-lg');
+ }
+
return styleClass;
}
@@ -269,6 +341,7 @@ export class ButtonDirective implements AfterViewInit, OnDestroy {
pRipple
[attr.data-pc-name]="'button'"
[attr.data-pc-section]="'root'"
+ [attr.tabindex]="tabindex"
>
@@ -363,7 +436,7 @@ export class Button implements AfterContentInit {
* Defines the style of the button.
* @group Props
*/
- @Input() severity: 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | string | undefined;
+ @Input() severity: 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | 'contrast' | string | undefined;
/**
* Add a border class without a background initially.
* @group Props
@@ -374,6 +447,7 @@ export class Button implements AfterContentInit {
* @group Props
*/
@Input({ transform: booleanAttribute }) link: boolean = false;
+ @Input({ transform: numberAttribute }) tabindex: number | undefined;
/**
* Defines the size of the button.
* @group Props