nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
4.14k stars 547 forks source link

[Table] Implement component #2139

Closed benjamincanac closed 1 month ago

robin-dongbin commented 1 month ago

It is recommended to provide Table and DataTable separately, with the Table component only wrapping basic style variants, while other advanced features are provided in DataTable. DataTable can reuse the style variants of the Table.

I believe that Table can be prioritized for development at this stage. As for whether to use Tanstack Table or others, that can be considered when developing the DataTable, and the DataTable can inherit the style variants of the Table, which will not lead to redundant work.

refs: [Vuetify] https://vuetifyjs.com/en/components/tables/#usage https://vuetifyjs.com/en/components/data-tables/introduction/#components

[Shadcn] https://www.shadcn-vue.com/docs/components/table.html https://www.shadcn-vue.com/docs/components/data-table.html

benjamincanac commented 1 month ago

This logic works for shadcn because they provide a primitive for each HTML element of the table. However, in Nuxt UI you will still have to pass a columns and items / rows props to the Table component which will render the table. It doesn't make sense to make two components for us.

robin-dongbin commented 1 month ago

I will explain my reasons for your reference: First of all, I hope to have a fully controllable table content rendering method while maintaining a unified UI style. Secondly, with the increase of functional requirements, Datatable will have a lot of internal complexity, which sometimes only It is too heavy to render an ordinary table. After clarifying, I want to say that developing a separate table component will not increase much workload, because its style can be completely inherited by Datatable, and because the table component contains almost no functions, there is almost no need for maintenance in the later stage. If you think table is completely unnecessary, or for compatibility with v2, I completely understand what you are saying, just clarifying my idea 🤔

UfukUstali commented 1 month ago

Feature request for table. I think it would be great to also have error state just like loading or empty state.