-
{{option.label}}
+ [ngClass]="{'ui-state-active':isSelected(option), 'ui-state-disabled':disabled, 'ui-state-focus': cbox == focusedItem,
+ 'ui-button-text-icon-left': (option.icon != null), 'ui-button-icon-only': (option.icon && !option.label)}" (click)="onItemClick($event,option,cbox,i)" [attr.title]="option.title">
+
+
{{option.label||'ui-btn'}}
diff --git a/src/app/showcase/components/selectbutton/selectbuttondemo.html b/src/app/showcase/components/selectbutton/selectbuttondemo.html
index 8182862eb5e..06eef965407 100644
--- a/src/app/showcase/components/selectbutton/selectbuttondemo.html
+++ b/src/app/showcase/components/selectbutton/selectbuttondemo.html
@@ -15,6 +15,10 @@
Multiple
Selected Types: {{type}}
+
Icon Only
+
+
Selected Modes: {{mode}}
+
@@ -121,6 +125,33 @@
Model Driven Forms
+
Icons
+
Button options can display icons using the icon property of the SelectItem API.
+
+
+<p-selectButton [options]="selectedType" [(ngModel)]="types"></p-selectButton>
+
+
+
+
+
+export class SelectButtonDemo {
+
+ types: SelectItem[];
+
+ selectedType: string;
+
+ constructor() {
+ this.types = [];
+ this.types.push({title: 'Paypal', value: 'PayPal', icon: 'fa fa-fw fa-cc-paypal'});
+ this.types.push({title: 'Visa', value: 'Visa', icon: 'fa fa-fw fa-cc-visa'});
+ this.types.push({title: 'MasterCard', value: 'MasterCard', icon: 'fa fa-fw fa-cc-mastercard'});
+ }
+}
+
+
+
+
Properties
@@ -223,11 +254,15 @@ Dependencies
<h3 class="first">Single</h3>
<p-selectButton [options]="types" [(ngModel)]="selectedType"></p-selectButton>
-<p>Selected Type: {{selectedType}}</p>
+<p>Selected Type: {{selectedType}}</p>
<h3>Multiple</h3>
<p-selectButton [options]="types" [(ngModel)]="selectedTypes" multiple="multiple"></p-selectButton>
-<p>Selected Types: <span *ngFor="let type of selectedTypes">{{type}} </span></p>
+<p>Selected Types: <span *ngFor="let type of selectedTypes">{{type}} </span></p>
+
+<h3>Icon Only</h3>
+<p-selectButton [options]="modes" [(ngModel)]="selectedMode" multiple="multiple"></p-selectButton>
+<p>Selected Modes: <span *ngFor="let mode of selectedMode">{{mode}} </span></p>
<hr />
@@ -243,19 +278,32 @@ Dependencies
selectedType: string;
- selectedTypes: string[] = ['Apartment','Studio'];
+ selectedTypes: string[] = ['PayPal','MasterCard'];
+
+ selectedModes: string[];
+
+ modes: SelectItem[];
constructor() {
- this.types = [];
- this.types.push({label: 'Apartment', value: 'Apartment'});
- this.types.push({label: 'House', value: 'House'});
- this.types.push({label: 'Studio', value: 'Studio'});
+ this.types = [
+ {label: 'Paypal', value: 'PayPal', icon: 'fa fa-fw fa-cc-paypal'},
+ {label: 'Visa', value: 'Visa', icon: 'fa fa-fw fa-cc-visa'},
+ {label: 'MasterCard', value: 'MasterCard', icon: 'fa fa-fw fa-cc-mastercard'}
+ ];
+
+ this.modes = [
+ {value: 'Bold', title: 'Bold', icon: 'fa fa-fw fa-bold'},
+ {value: 'Italic', title: 'Italic', icon: 'fa fa-fw fa-italic'},
+ {value: 'Underline', title: 'Underline', icon: 'fa fa-fw fa-underline'}
+ ];
}
clear() {
this.selectedType = null;
this.selectedTypes = [];
+ this.selectedModes = [];
}
+
}
diff --git a/src/app/showcase/components/selectbutton/selectbuttondemo.ts b/src/app/showcase/components/selectbutton/selectbuttondemo.ts
index b30eddf3d79..8d64dd16f00 100644
--- a/src/app/showcase/components/selectbutton/selectbuttondemo.ts
+++ b/src/app/showcase/components/selectbutton/selectbuttondemo.ts
@@ -10,17 +10,29 @@ export class SelectButtonDemo {
selectedType: string;
- selectedTypes: string[] = ['Apartment','Studio'];
+ selectedTypes: string[] = ['PayPal','MasterCard'];
+
+ selectedModes: string[];
+
+ modes: SelectItem[];
constructor() {
- this.types = [];
- this.types.push({label: 'Apartment', value: 'Apartment'});
- this.types.push({label: 'House', value: 'House'});
- this.types.push({label: 'Studio', value: 'Studio'});
+ this.types = [
+ {label: 'Paypal', value: 'PayPal', icon: 'fa fa-fw fa-cc-paypal'},
+ {label: 'Visa', value: 'Visa', icon: 'fa fa-fw fa-cc-visa'},
+ {label: 'MasterCard', value: 'MasterCard', icon: 'fa fa-fw fa-cc-mastercard'}
+ ];
+
+ this.modes = [
+ {value: 'Bold', title: 'Bold', icon: 'fa fa-fw fa-bold'},
+ {value: 'Italic', title: 'Italic', icon: 'fa fa-fw fa-italic'},
+ {value: 'Underline', title: 'Underline', icon: 'fa fa-fw fa-underline'}
+ ];
}
clear() {
this.selectedType = null;
this.selectedTypes = [];
+ this.selectedModes = [];
}
}
\ No newline at end of file