simplebar
simplebar copied to clipboard
Is it possible to set SimpleBar width based on content width?
💬 Questions and Help
Is it possible to set SimpleBar width based on content width, without using JavaScript to access DOM/Calculate/Update SimpleBar width? Something like (React example):
<SimpleBar className="max-height-20rem width-max-content">
<MyList />
</Simplebar>
.max-height-20rem {
max-height: 20rem;
}
.width-max-content {
width: max-content; /* This obviously does not work /*
}
+1! The legacy/deprecated jquery.scrollbar allowed the whole scroll area to grow with its content width - even allowing for CSS width transitions. It would be great if this is also possible with simplebar as I migrate to it.
It works for me:
.simplebar-placeholder {
width: max-content !important;
}
@idefant: That's a good point! The now well-supported CSS keywords make many things possible that were not in the past. Thanks!