Collections (Checkboxes, Radios, Select)
Overview
Checkboxes
Boolean Checkboxes
export class PreferencesForm {
emailNotifications = false;
smsNotifications = true;
pushNotifications = false;
get hasValidNotificationPrefs(): boolean {
return this.emailNotifications || this.smsNotifications || this.pushNotifications;
}
}<form>
<fieldset>
<legend>Notification Preferences</legend>
<label>
<input type="checkbox" checked.bind="emailNotifications" />
Email notifications
</label>
<label>
<input type="checkbox" checked.bind="smsNotifications" />
SMS notifications
</label>
<label>
<input type="checkbox" checked.bind="pushNotifications" />
Push notifications
</label>
</fieldset>
<div if.bind="!hasValidNotificationPrefs" class="warning">
Please select at least one notification method.
</div>
</form>Array-Based Multi-Select
Set-Based Collections
Map-Based Collections
Radio Buttons
Basic Radio Buttons
Radio Buttons with Objects
Select Elements
Basic Select
Select with Objects
Select with Optgroups
Multi-Select
Performance Considerations
Collection Type
Best For
Performance
Matchers Explained
Common Patterns
Select All / Deselect All
Conditional Options
Related
Last updated
Was this helpful?