Angular scrollable mat-selection-list?
I have a question. I didnt find any familiar question on stack so i asking here, is it possible to make <mat-selection-list>
scrollable (Angular 7)? I want to display scroll-bar on the right when items is too many to fit a window.
<mat-card fxFlex="33%">
<mat-selection-list>
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)"
>
</mat-list-item>
</mat-selection-list>
angular angular-material angular-material2
add a comment |
I have a question. I didnt find any familiar question on stack so i asking here, is it possible to make <mat-selection-list>
scrollable (Angular 7)? I want to display scroll-bar on the right when items is too many to fit a window.
<mat-card fxFlex="33%">
<mat-selection-list>
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)"
>
</mat-list-item>
</mat-selection-list>
angular angular-material angular-material2
1
Can you provide sample example first?
– Just code
Dec 31 '18 at 12:42
add a comment |
I have a question. I didnt find any familiar question on stack so i asking here, is it possible to make <mat-selection-list>
scrollable (Angular 7)? I want to display scroll-bar on the right when items is too many to fit a window.
<mat-card fxFlex="33%">
<mat-selection-list>
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)"
>
</mat-list-item>
</mat-selection-list>
angular angular-material angular-material2
I have a question. I didnt find any familiar question on stack so i asking here, is it possible to make <mat-selection-list>
scrollable (Angular 7)? I want to display scroll-bar on the right when items is too many to fit a window.
<mat-card fxFlex="33%">
<mat-selection-list>
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)"
>
</mat-list-item>
</mat-selection-list>
angular angular-material angular-material2
angular angular-material angular-material2
asked Dec 31 '18 at 12:39
michasaucermichasaucer
28317
28317
1
Can you provide sample example first?
– Just code
Dec 31 '18 at 12:42
add a comment |
1
Can you provide sample example first?
– Just code
Dec 31 '18 at 12:42
1
1
Can you provide sample example first?
– Just code
Dec 31 '18 at 12:42
Can you provide sample example first?
– Just code
Dec 31 '18 at 12:42
add a comment |
3 Answers
3
active
oldest
votes
Simple CSS
mat-selection-list {
max-height: 400px;
overflow: auto;
}
StackBlitz Demo
It works! thanks.
– michasaucer
Dec 31 '18 at 13:27
add a comment |
You can try with:
<mat-card fxFlex="33%">
<mat-selection-list [style.overflow]="'auto'" [style.height.px]="'300'">
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)">
</mat-list-item>
</mat-selection-list>
add a comment |
By setting custom CSS properties?
CSS for fancy scroll bar which only supports Chrome browsers:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
overflow-x: hidden;
}
.custom-scroll-bar::-webkit-scrollbar{
width: 5px;
}
.custom-scroll-bar::-webkit-scrollbar-thumb{
background: rgba(0,0,0,.26);
}
For Firefox and Internet explorer just simply use:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
}
HTML:
<mat-selection-list #shoes class="custom-scroll-bar">
<mat-list-option *ngFor="let shoe of typesOfShoes">
{{shoe}}
</mat-list-option>
</mat-selection-list>
StackBlitz Example
2
-webkit-scrollbar
works only on Chrome.
– Oen44
Dec 31 '18 at 12:59
you got it right!
– Prashant Pimpale
Dec 31 '18 at 13:21
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53987643%2fangular-scrollable-mat-selection-list%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Simple CSS
mat-selection-list {
max-height: 400px;
overflow: auto;
}
StackBlitz Demo
It works! thanks.
– michasaucer
Dec 31 '18 at 13:27
add a comment |
Simple CSS
mat-selection-list {
max-height: 400px;
overflow: auto;
}
StackBlitz Demo
It works! thanks.
– michasaucer
Dec 31 '18 at 13:27
add a comment |
Simple CSS
mat-selection-list {
max-height: 400px;
overflow: auto;
}
StackBlitz Demo
Simple CSS
mat-selection-list {
max-height: 400px;
overflow: auto;
}
StackBlitz Demo
answered Dec 31 '18 at 12:55
Oen44Oen44
1,8001818
1,8001818
It works! thanks.
– michasaucer
Dec 31 '18 at 13:27
add a comment |
It works! thanks.
– michasaucer
Dec 31 '18 at 13:27
It works! thanks.
– michasaucer
Dec 31 '18 at 13:27
It works! thanks.
– michasaucer
Dec 31 '18 at 13:27
add a comment |
You can try with:
<mat-card fxFlex="33%">
<mat-selection-list [style.overflow]="'auto'" [style.height.px]="'300'">
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)">
</mat-list-item>
</mat-selection-list>
add a comment |
You can try with:
<mat-card fxFlex="33%">
<mat-selection-list [style.overflow]="'auto'" [style.height.px]="'300'">
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)">
</mat-list-item>
</mat-selection-list>
add a comment |
You can try with:
<mat-card fxFlex="33%">
<mat-selection-list [style.overflow]="'auto'" [style.height.px]="'300'">
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)">
</mat-list-item>
</mat-selection-list>
You can try with:
<mat-card fxFlex="33%">
<mat-selection-list [style.overflow]="'auto'" [style.height.px]="'300'">
<mat-list-item
*ngFor="let product of products"
[class.selected]="product === selectedproduct"
(click)="onSelect(product)">
</mat-list-item>
</mat-selection-list>
answered Dec 31 '18 at 12:48
jaasojaaso
69937
69937
add a comment |
add a comment |
By setting custom CSS properties?
CSS for fancy scroll bar which only supports Chrome browsers:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
overflow-x: hidden;
}
.custom-scroll-bar::-webkit-scrollbar{
width: 5px;
}
.custom-scroll-bar::-webkit-scrollbar-thumb{
background: rgba(0,0,0,.26);
}
For Firefox and Internet explorer just simply use:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
}
HTML:
<mat-selection-list #shoes class="custom-scroll-bar">
<mat-list-option *ngFor="let shoe of typesOfShoes">
{{shoe}}
</mat-list-option>
</mat-selection-list>
StackBlitz Example
2
-webkit-scrollbar
works only on Chrome.
– Oen44
Dec 31 '18 at 12:59
you got it right!
– Prashant Pimpale
Dec 31 '18 at 13:21
add a comment |
By setting custom CSS properties?
CSS for fancy scroll bar which only supports Chrome browsers:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
overflow-x: hidden;
}
.custom-scroll-bar::-webkit-scrollbar{
width: 5px;
}
.custom-scroll-bar::-webkit-scrollbar-thumb{
background: rgba(0,0,0,.26);
}
For Firefox and Internet explorer just simply use:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
}
HTML:
<mat-selection-list #shoes class="custom-scroll-bar">
<mat-list-option *ngFor="let shoe of typesOfShoes">
{{shoe}}
</mat-list-option>
</mat-selection-list>
StackBlitz Example
2
-webkit-scrollbar
works only on Chrome.
– Oen44
Dec 31 '18 at 12:59
you got it right!
– Prashant Pimpale
Dec 31 '18 at 13:21
add a comment |
By setting custom CSS properties?
CSS for fancy scroll bar which only supports Chrome browsers:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
overflow-x: hidden;
}
.custom-scroll-bar::-webkit-scrollbar{
width: 5px;
}
.custom-scroll-bar::-webkit-scrollbar-thumb{
background: rgba(0,0,0,.26);
}
For Firefox and Internet explorer just simply use:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
}
HTML:
<mat-selection-list #shoes class="custom-scroll-bar">
<mat-list-option *ngFor="let shoe of typesOfShoes">
{{shoe}}
</mat-list-option>
</mat-selection-list>
StackBlitz Example
By setting custom CSS properties?
CSS for fancy scroll bar which only supports Chrome browsers:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
overflow-x: hidden;
}
.custom-scroll-bar::-webkit-scrollbar{
width: 5px;
}
.custom-scroll-bar::-webkit-scrollbar-thumb{
background: rgba(0,0,0,.26);
}
For Firefox and Internet explorer just simply use:
.custom-scroll-bar{
height:70vh;
overflow-y:scroll;
}
HTML:
<mat-selection-list #shoes class="custom-scroll-bar">
<mat-list-option *ngFor="let shoe of typesOfShoes">
{{shoe}}
</mat-list-option>
</mat-selection-list>
StackBlitz Example
edited Dec 31 '18 at 13:33
answered Dec 31 '18 at 12:51
Prashant PimpalePrashant Pimpale
3,3423830
3,3423830
2
-webkit-scrollbar
works only on Chrome.
– Oen44
Dec 31 '18 at 12:59
you got it right!
– Prashant Pimpale
Dec 31 '18 at 13:21
add a comment |
2
-webkit-scrollbar
works only on Chrome.
– Oen44
Dec 31 '18 at 12:59
you got it right!
– Prashant Pimpale
Dec 31 '18 at 13:21
2
2
-webkit-scrollbar
works only on Chrome.– Oen44
Dec 31 '18 at 12:59
-webkit-scrollbar
works only on Chrome.– Oen44
Dec 31 '18 at 12:59
you got it right!
– Prashant Pimpale
Dec 31 '18 at 13:21
you got it right!
– Prashant Pimpale
Dec 31 '18 at 13:21
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53987643%2fangular-scrollable-mat-selection-list%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Can you provide sample example first?
– Just code
Dec 31 '18 at 12:42