Skip to content

Add Table row styling#1360

Open
FlyersPh9 wants to merge 25 commits intomainfrom
jon/table-row-selection
Open

Add Table row styling#1360
FlyersPh9 wants to merge 25 commits intomainfrom
jon/table-row-selection

Conversation

@FlyersPh9
Copy link
Copy Markdown
Collaborator

@FlyersPh9 FlyersPh9 commented Mar 24, 2026

Changes

  • Change table header font styling.
  • Change table body row hover styling.
  • Change table cell spacing.
  • Add sample for row selection.

Deploy preview 👀

Before After
Screenshot 2026-04-17 at 3 49 33 PM Screenshot 2026-04-17 at 3 50 29 PM

Screenshots show:

  • Eclair row is hovered.
  • Gingerbread row is selected.
  • Ice cream sandwich row is selected & hovered.

Testing

  • forced-colors is matching legacy StrataKit table. Would of liked to style the selected row differently, but the checkbox will suffice.

@FlyersPh9 FlyersPh9 marked this pull request as ready for review April 17, 2026 19:27
@FlyersPh9 FlyersPh9 requested a review from a team as a code owner April 17, 2026 19:27
@FlyersPh9 FlyersPh9 requested review from GerardasB and mayank99 and removed request for a team April 17, 2026 19:27
Comment thread examples/mui/Table.select.tsx Outdated
Comment thread examples/mui/Table.select.tsx Outdated
Comment thread examples/mui/Table.select.tsx Outdated
Comment thread examples/mui/Table.select.tsx Outdated
return (
<TableRow
key={row.id}
hover
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we enable hover by default? It can be useful as a visual guide just for reading long rows without getting lost.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hover interaction might signal to the end user that it's intractable.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the cursor change in 4f2c9a0 / #1360 (comment) is tied to hover.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hover background change alone does not signal to the user that it's interactable. We used a hover background on all rows in the legacy Table just as a visual guide. "Interactable" row does not even make sense on its own; there should always be an explicit action (e.g. a checkbox in this case, or a button as shown in iTwinUI docs).

Ideally we would use the hover background with the default cursor, and add cursor: pointer when the row is selectable. Is this possible?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look for .MuiTableCell-paddingCheckbox within the row and apply the cursor. I think if the checkbox column is present then that must mean the row is selectable. ce355d9

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about hover as default?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried adding hover to TableRow but that gave the header row hover as well:

MuiTableRow: {
	defaultProps: { component: withRenderProp(Role, "tr"), hover: true },
},

Basically I need to check "if the TableRow is within TableBody then change the hover default to true". So now I'm exploring what I can do with MuiTableBody.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah true. I can open a follow-up PR so we can keep this moving.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up PR is #1444.

Comment thread examples/mui/Table.select.tsx Outdated
Comment thread examples/mui/Table.select.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants