Skip to content

Commit

Permalink
feat(data-table): add colSpan prop for TableHeader (#5088)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack authored and tw15egan committed Jan 17, 2020
1 parent 65cce52 commit c061bcc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/react/src/components/DataTable/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const TableHeader = React.forwardRef(function TableHeader(
{
className: headerClassName,
children,
colSpan,
isSortable,
isSortHeader,
onClick,
Expand All @@ -63,7 +64,7 @@ const TableHeader = React.forwardRef(function TableHeader(
) {
if (!isSortable) {
return (
<th {...rest} className={headerClassName} scope={scope}>
<th {...rest} className={headerClassName} scope={scope} colSpan={colSpan}>
<span className={`${prefix}--table-header-label`}>{children}</span>
</th>
);
Expand All @@ -80,10 +81,11 @@ const TableHeader = React.forwardRef(function TableHeader(

return (
<th
scope={scope}
className={headerClassName}
aria-sort={ariaSort}
ref={ref}>
className={headerClassName}
colSpan={colSpan}
ref={ref}
scope={scope}>
<button className={className} onClick={onClick} {...rest}>
<span className={`${prefix}--table-header-label`}>{children}</span>
<Arrow
Expand Down Expand Up @@ -120,6 +122,12 @@ TableHeader.propTypes = {
*/
children: PropTypes.node,

/**
* Specify `colSpan` as a non-negative integer value to indicate how
* many columns the TableHeader cell extends in a table
*/
colSpan: PropTypes.number,

/**
* Specify whether this header is one through which a user can sort the table
*/
Expand Down

0 comments on commit c061bcc

Please sign in to comment.