1

enter image description here

Link:- https://stackblitz.com/angular/qmedkbvramy?file=app%2Fcdk-virtual-scroll-overview-example.ts

I am trying angular material scollbar look as in the attached picture. But I can't figure out, how to do this.

2
  • I don't think material provides a native way to style this one, you need to use css to achieve the desire result. Commented Nov 22, 2018 at 7:29
  • Thanks, Can you help me with desired css. Commented Nov 22, 2018 at 7:32

1 Answer 1

3

Material by default doesn't provide any styles to change the scrolling

You can use this css to change the scrollbar style

cdk-virtual-scroll-viewport::-webkit-scrollbar-track
{
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
    border-radius: 10px;
    background-color: #F5F5F5;
}

cdk-virtual-scroll-viewport::-webkit-scrollbar
{
    width: 12px;
    background-color: #F5F5F5;
}

cdk-virtual-scroll-viewport::-webkit-scrollbar-thumb
{
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
    background-color: #555;
}

Stackblitz demo: https://stackblitz.com/edit/angular-jkw9ac

Sign up to request clarification or add additional context in comments.

7 Comments

Thanks, one issue is there- list is going up but corresponding scroll is not moving as the list goes up. Its kinda bug or something.
@Ahmadmnzr not a bug but, as many items are there it moves slowly
@Justcode did you notice the flashing issue on scroll? when we override scrollbar styles, it's not flashing on scrolling.but it seems the performance is different. any idea why this is happening?
@NaeimFard I did not, Can you explain more?
@Justcode stackblitz.com/edit/angular-jkw9ac-dpnnaw drag scroll thumb by mouse to see the difference
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.