Skip to content
Latestv1.0.60

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.

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.

Highlight Column

Header Prefix Icon

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

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.

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.

Auto Wrap

Overflow Hidden

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

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.