ui icon indicating copy to clipboard operation
ui copied to clipboard

`th` styles not applying to sortable columns in `UTable`

Open CepreR opened this issue 1 year ago • 2 comments

Environment

Version

v2.18.4

Reproduction

https://stackblitz.com/edit/nuxt-ui-xz318d?file=app.vue

Description

th styles not applying to sortable columns in UTable

When using the UTable component, custom styles applied to the th element (e.g., color: 'text-pink-400') do not affect columns marked as sortable. This results in inconsistent styling between sortable and non-sortable columns.

Steps to Reproduce:

Define a UTable with custom th styles. Include both sortable and non-sortable columns. Observe that the custom styles are not applied to the sortable columns.

Expected Behavior

All column headers should apply the specified th styles, regardless of whether they are sortable.

Additional context

image

Logs

No response

CepreR avatar Aug 29 '24 13:08 CepreR

Additionally, attempting to modify the default.sortButton configuration (e.g., icon, color, variant) does not have any effect:

    sortButton: {
      color: 'red',
    },

CepreR avatar Aug 29 '24 13:08 CepreR

It deals with a sortable column th as a custom button with custom styles.

You can customize it however you want and match its style with your own "th". Here’s how you can give it a pink color: <UTable :columns="columns" :rows="people" :ui="{ th: { color: 'text-pink-500' } }" :sort-button="{ color: 'pink' }"/>

NasrALdaya avatar Sep 17 '24 10:09 NasrALdaya

We separate custom on sort button and table header to make it more flexible. You @CepreR can try as commented by @NasrALdaya

rdjanuar avatar Nov 13 '24 08:11 rdjanuar