-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Use links for pagination #945
Comments
Hey Jason, you should be able to use the |
An example would be helpful in the docs since this will be a very common need for pagination, but its not clear about how to currently |
I think the main use case for pagination does need links. Also, there are so many packages for tables/tabular data, with pagination included, which seems to be the most popular use case for pagination which doesn't need links. I second @jasongitmail on this, it would be nice to have full examples, for me it's been very hard to use it without a single full example anywhere (google doesn't have a single one). |
Have you been able to find a working solution for this? I was looking through a documentation and issues on shadcn-svelte and bits-ui, but I couldn't find anything useful. I tried to use children or child snippet on This is my best try:
With this code, next/previous buttons works as expected, minus disabled function on them when you are at the end of the list. But Mind that child snippet can't be added to |
Describe the feature
My understanding is the pagination element uses
onPageChange()
to programmatically navigate.This creates downsides related to progressive enhancement (links won't work for SSR'd pages when user has JS disabled), SEO (b/c no anchor elements for a crawler to follow), and potentially speed (but I haven't confirmed if SvelteKit preloads destination pages, b/c I decided to keep my custom pagination element for now for the reasons described here).
An alternate approach could be to:
a
elements for the page links.The caveat is that the current callback may be more flexible for something like in-page tables, but you could argue the dev should be updating the URL state and that nudges them in the right direction. Or alternatively,
onPageChange()
could be retained as a fallback if thehref
prop is not specified, although this brings some added implementation complexity.(Will let you transfer the issue to Bits UI if you prefer it to live there.)
The text was updated successfully, but these errors were encountered: