Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtual: <VirtualList> needs listClass prop #698

Open
andraaspar opened this issue Sep 27, 2024 · 1 comment
Open

virtual: <VirtualList> needs listClass prop #698

andraaspar opened this issue Sep 27, 2024 · 1 comment

Comments

@andraaspar
Copy link

Describe The Problem To Be Solved

I've found that when using <VirtualList> I could not style the list <div>. The styles I needed were:

display: flex;
flex-flow: column;
width: 100%;

Suggest A Solution

I think the right way is to let us have an optional listClass prop so we can style the list directly. This will not break any existing implementations. Like this:

<div
	class={props.listClass}
	style={{
		position: 'absolute',
		top: `${getFirstIdx() * props.rowHeight}px`,
	}}
>
	<For
		fallback={props.fallback}
		each={items().slice(getFirstIdx(), getLastIdx()) as any as T}
	>
		{props.children}
	</For>
</div>
@thetarnav
Copy link
Member

thetarnav commented Sep 27, 2024

First of many issues on virtual I expect, this is why I hate shipping jsx here. The user should be in full control of rendering.
Well listClass seems like an appropriate solution, if you submit a PR, I'll probably merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants