Any plans to include table component ? - chakra-ui TypeScript
if any, Is it going to be implemented from scratch or wrapper around something like react-table
react-table
9 Answer:
Hi everyone, I have recently implemented a basic table using react-table
v7 new headless API with chakra. Would be happy to make a PR if anyone would be interested in checking it out?
It's pretty simple, usage would be as follows:
<Table columns={columns} data={data} />
And it looks like this:
Out the box it has client side sorting by column headers, single page navigation, updating number of rows visible, page count & navigating to the first / last page. In terms of responsiveness it adops the overflow-x
approach so the user can scroll the table content.
Lemme know what you think!
Hi all, here's my table implementation: https://codesandbox.io/s/upbeat-christian-3hbgp?file=/src/index.tsx.
Note that it doesn't try to do anything fancy with data. It is mainly about the table styles.
If people are interested, I can add an example of using data to generate the table, but I'm following the standard React pattern of mapping over an array. I'm not using the object style of react-table
to generate headings and rows.
Here are some nice ideas for table designs (from https://twitter.com/steveschoger/status/1167479729282310145):
Hi @nejcr, see code sandbox below with a basic example 👍
https://codesandbox.io/s/chakra-ui-react-table-o6psn
Hi @ngprnk,
Thanks for asking. A wrapper around react-table
sounds like a good idea. There are 2 ways to approach this.
Provide simple Table components that make it easy to style tables. Bonus point if we can provide 2-4 variants (looks) of the table out of the box
Provide a more robust table solution, wrapping
react-table
and makes it super easy to compose different use cases. This path will most likely be a separate package, say@chakra-ui/table
so we don't increase the size of@chakra-ui/core
What are your thoughts?
IMO creating a wrapper for react-table
isn't a good idea. I think it should handle styling/UI only.
Personally, I'd prefer to keep my project as clean as possible, and I wouldn't like to add react-table
as a dependency if I wanted to use a simple table.
If someone want to use with react-table
they'll be able to use it anyway, using useTable
. It'll be better for composing purpose.
Thank you all for the feedback and ideas!
Having a set of components for building tables would definitely be cool to have, but tables are also complex and come with a lot of edge cases to deal with (especially when it comes to dealing with responsiveness).
There's clearly a desire in the community to have this feature. Hopefully as we get through v1 and have more time to consider new ideas, we can figure out a direction to proceed.
Happy to announce that basic table support is now part of our current focus!
Hey folks, I stumbled into this issue yesterday while looking for something that would help me, the links provided by others are great, but i was looking for the simplest cases in simple js, so I made three very basic examples forked from the react-query
codesandbox, they are using @chakra-ui/core@1.0.0-next.6
but the API should be very similar.
Hope this helps someone. 🙂
Simple: https://codesandbox.io/s/simple--react-table--chakra-ui-3sem5 Footers: https://codesandbox.io/s/footers--react-table--chakra-ui-5x58q Sorting: https://codesandbox.io/s/sorting--react-table--chakra-ui-h1qx9
Read next
- tailwind-rn - Vue Native JavaScript
- [Bug] Remote Config: Setting MinimumFetchInternalInMilliseconds does not work as expected - quickstart-unity
- LightGBM [R Package] autoconf.ac OpenMP test ignores LDFLAGS (fix provided). - Cplusplus
- bind EINVAL on valid IPv6 Address (IPv4 works fine!) - JavaScript node
- Nightly builds - logisim-evolution Java
- darktable Crash Report C
- joint Rappid visio import Link vertices - JavaScript
- iOS 13 requires new headers to the APNS - Ruby houston