Skip to content

Table: conditionally apply classes to tr and td elements #3865

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

Closed
andr35 opened this issue Apr 11, 2025 · 1 comment · Fixed by #3866
Closed

Table: conditionally apply classes to tr and td elements #3865

andr35 opened this issue Apr 11, 2025 · 1 comment · Fixed by #3866
Labels
enhancement New feature or request v3 #1289

Comments

@andr35
Copy link
Contributor

andr35 commented Apr 11, 2025

Description

Description

In Nuxt UI v3, there is currently no way to apply custom styles or classes to individual table rows or cells. Additionally, it is not possible to dynamically set classes based on specific criteria, for example, the value of data displayed in a given cell.

In contrast, this feature was available in Nuxt UI v2, as documented in the official documentation. In that version, custom classes could be applied by simply adding a class property to a specific row's data:

const items = [{
  id: 1,
  name: 'Apple',
  quantity: { value: 100, class: 'bg-green-500/50 dark:bg-green-400/50' }
}, {
  id: 2,
  name: 'Orange',
  quantity: { value: 0 },
  // Class property
  class: 'bg-red-500/50 dark:bg-red-400/50 animate-pulse'
}]

Additional context

No response

@dreamgear
Copy link

I was invited to "Start your project using the nuxt/starter#ui template with Nuxt UI pre-configured." (from https://ui.nuxt.com/getting-started/installation/nuxt). I did that, and found myself using Nuxt-UI V3.x. Lots of changes, of course, but everything seemed good until I crashed head-on into this problem.

I should have noticed that a whole page of examples for Table had no row styles.

Thanks for your work and do know that row style is critical for every app I've ever written that uses tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v3 #1289
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants