feat(mat-selection-list): add slide toggle as alternative for checkbox
See original GitHub issueBug, feature request, or proposal:
feature request
What is the expected behavior?
Option lists can have slide toggles instead of checkboxes, as you can see on Android OS.
What is the current behavior?
Option lists are only for checkboxes and if you want to create something that has the same look but has a slide toggle instead, you will have to implement by yourself.
What is the use-case or motivation for changing an existing behavior?
Its a very common option list format, very used on Android 5~6.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Material 5.1
Is there anything else we should know?
You can find it in Material’s guidelines: (switches are very cute btw)
Cute sidebar example:
(inspired by Twitter’s PWA, achieved with slide-toggle, mat-list and ::ng-deep
, that’s a lot more than I expect to write)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:12 (8 by maintainers)
Top Results From Across the Web
How to change VISUAL state on Angular mat-slide-toggle and ...
After trial and error, I found the following solution: <mat-slide-toggle formControlName="onlineOnly" [checked]="onlineOnlyChecked">Online ...
Read more >angular/cdk - Awesome JS
listbox: set initial focus to selected option (#26174) ... feat - 8554e1538 ... schematics: add slide toggle styles migrator and tests. feat -...
Read more >Slide toggle | Angular Material
<mat-slide-toggle> is an on/off control that can be toggled via clicking. ... Slide me! The slide-toggle behaves similarly to a checkbox, though it...
Read more >components: CHANGELOG.md - Fossies
f61a21382, fix, select: changed after checked error if option label changes ... 7646c73c32, feat, schematics: add slide toggle styles migrator and tests.
Read more >angular/material - Gitter
mat-selection-list .mat-list-option { display: block; height: 48px; How can I override these class and remove the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
cc. @jelbourn
This would be actually pretty easy to implement. We could have something like a
[indicatorType]
input binding that allows deciding which indicator to use (e.g.checkbox
,slide-toggle
).It just feels a bit unfortunate, that we would need to have a dependency on the
MatSlideToggleModule
. We could fix that by either letting the user project the indicator manually, or by having a separate module for the selection list.Thank you for submitting your feature request! Looks like during the polling process it didn’t collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular’s scope, we’d encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.