Skip to content

Table - Highlight & Style

Through table properties and column configuration, implement row highlight, column highlight, header icons, content wrapping and overflow style control.

Highlight Row

After setting highlight-current-row, clicking a table row will highlight it.

Click a row to highlight it. Clicking another row switches the highlight.

Name
Age
Department
Salary
Address
John
28
Engineering
15000
88 Jianguo Rd, SOHO Modern City, Chaoyang, Beijing
Jane
32
Product
18000
100 Century Ave, Shanghai World Financial Center, Pudong, Shanghai
Mike
25
Design
14000
385 Tianhe Rd, Taikoo Hui Tower 1, Tianhe, Guangzhou
Sarah
35
Operations
22000
9966 Shennan Blvd, VIA Technologies Building, Nanshan, Shenzhen
Tom W.
29
Marketing
16000
398 Wensan Rd, Dongxin Building B, Xihu, Hangzhou
Highlight Current Row

Highlight Column

Dynamically set column className to is-column-highlight through the cell-click event to highlight the entire column when clicking a cell.

Click a cell to highlight the entire column.

Name
Age
Department
Salary
Address
John
28
Engineering
15000
88 Jianguo Rd, SOHO Modern City, Chaoyang, Beijing
Jane
32
Product
18000
100 Century Ave, Shanghai World Financial Center, Pudong, Shanghai
Mike
25
Design
14000
385 Tianhe Rd, Taikoo Hui Tower 1, Tianhe, Guangzhou
Sarah
35
Operations
22000
9966 Shennan Blvd, VIA Technologies Building, Nanshan, Shenzhen
Tom W.
29
Marketing
16000
398 Wensan Rd, Dongxin Building B, Xihu, Hangzhou
Highlight Column

Header Prefix Icon

Add icons before header text through column config headerPrefixIcon property. Supports passing Vue components (such as SVG icon components).

Name
Age
Department
Address
John
28
Engineering
88 Jianguo Rd, SOHO Modern City, Chaoyang, Beijing
Jane
32
Product
100 Century Ave, Shanghai World Financial Center, Pudong, Shanghai
Mike
25
Design
385 Tianhe Rd, Taikoo Hui Tower 1, Tianhe, Guangzhou
Header Prefix Icon

Header Suffix Icon

Add icons after header text through column config headerSuffixIcon property, commonly used to mark required fields or hint information.

Name*
Age
Department
Salary*
Address
John
28
Engineering
15000
88 Jianguo Rd, SOHO Modern City, Chaoyang, Beijing
Jane
32
Product
18000
100 Century Ave, Shanghai World Financial Center, Pudong, Shanghai
Mike
25
Design
14000
385 Tianhe Rd, Taikoo Hui Tower 1, Tianhe, Guangzhou
Header Suffix Icon

Auto Wrap

Add class="is-auto-wrap" to yh-table to enable automatic cell content wrapping, suitable for scenarios displaying long text.

Name
Content Description
Status
John
This is a very long text content used to test the auto-wrap effect of cells. You can see that the text wraps automatically instead of being truncated. Long descriptions are often needed in real projects.
In Progress
Jane
Short text
Completed
Mike
This is also a longer content with various detail descriptions, such as project requirements analysis, feature design specs, and testing acceptance criteria.
Pending Review
Auto Wrap

Overflow Hidden

Configure column with showOverflowTooltip: true to automatically ellipsis content that exceeds column width, showing a full content Tooltip on hover.

Name
Address (Overflow Hidden + Tooltip)
Department
John
88 Jianguo Rd, SOHO Modern City, Chaoyang, Beijing
Engineering
Jane
100 Century Ave, Shanghai World Financial Center, Pudong, Shanghai
Product
Mike
385 Tianhe Rd, Taikoo Hui Tower 1, Tianhe, Guangzhou
Design
Sarah
9966 Shennan Blvd, VIA Technologies Building, Nanshan, Shenzhen
Operations
Tom W.
398 Wensan Rd, Dongxin Building B, Xihu, Hangzhou
Marketing
Overflow Hidden + Tooltip

API

Highlight Properties

PropertyDescriptionTypeDefault
highlight-current-rowWhether to highlight the currently clicked rowbooleanfalse
current-row-key / v-model:current-row-keyKey value of the currently highlighted rowstring | number

Highlight Events

EventDescriptionParameters
current-changeTriggered when the current row changes(currentRow, oldRow)

Column Highlight

Implement column highlight by dynamically setting the is-column-highlight class name through the column className property.

PropertyDescriptionTypeDefault
classNameCustom class name for the columnstring

Header Icon Properties

PropertyDescriptionTypeDefault
headerPrefixIconHeader prefix icon (Vue component or string)string | Component
headerSuffixIconHeader suffix icon (Vue component or string)string | Component

Wrapping & Overflow

UsageDescriptionType
class="is-auto-wrap"Table-level auto wrap (add to yh-table)string
showOverflowTooltipColumn-level overflow hidden, show tooltip on hoverboolean | TooltipConfig
ellipsisColumn-level ellipsisboolean | EllipsisConfig

showOverflowTooltip Config (TooltipConfig)

PropertyDescriptionTypeDefault
effectTooltip theme'dark' | 'light''dark'
placementTooltip placementstring'top'
offsetTooltip offsetnumber

ellipsis Config (EllipsisConfig)

PropertyDescriptionTypeDefault
tooltipWhether to show tooltip when truncatedbooleanfalse
lineClampLimit the number of displayed rowsnumber

Released under the MIT License.