Skip to content

Conversation

@BouklifYacine
Copy link
Contributor

  • Create TableStructuredCell for tree-view/expandable functionality
  • Simplify TableCell to be a pure composable wrapper with children prop
  • Remove IconTextIcon usage in table context (eliminates extra wrapper div)
  • Replace TanStack Row prop with primitive props (depth, isExpandable, isExpanded, onToggleExpand)
  • Delete unused TableCellChips, TableCellDate, TableCellNumber components
  • Add flex layout with gap for cell content via CSS

- Create TableStructuredCell for tree-view/expandable functionality
- Simplify TableCell to be a pure composable wrapper with children prop
- Remove IconTextIcon usage in table context (eliminates extra wrapper div)
- Replace TanStack Row prop with primitive props (depth, isExpandable, isExpanded, onToggleExpand)
- Delete unused TableCellChips, TableCellDate, TableCellNumber components
- Add flex layout with gap for cell content via CSS
@BouklifYacine BouklifYacine self-assigned this Dec 23, 2025
@BouklifYacine BouklifYacine linked an issue Dec 23, 2025 that may be closed by this pull request
}

// Flex container for cell content (chips, icons, etc.)
.moonstone-tableCellContentWrapper {
Copy link
Collaborator

Choose a reason for hiding this comment

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

To avoid repeating the same CSS, you can use our helper classes from layout.scss flexRow, alignCenter

className
)}
style={{width: width}}
style={{width}}
Copy link
Collaborator

@ffffffelix ffffffelix Dec 23, 2025

Choose a reason for hiding this comment

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

  • I think we need to specify the property width
  • Don't forget to add props.style to allow our user to add custom style here

/**
* Whether this row is currently expanded
*/
isExpanded: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this prop be optional? Because if the item is not expandable there is no reason to provide isExpanded

/**
* Callback fired when the expand/collapse toggle is clicked
*/
onToggleExpand: () => void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this prop be optional?

Comment on lines 63 to 78
<Typography
ref={ref}
component={component}
variant="body"
className={clsx(
'moonstone-TableCell',
'textAlign' + capitalize(textAlign),
'moonstone-verticalAlign' + capitalize(verticalAlign),
{flexFluid: typeof width === 'undefined'},
className
)}
style={{width}}
{...props}
>
{renderContent()}
</Typography>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should call TableCell directly instead of duplicating the code?

const renderContent = () => {
if (isExpandable) {
return (
<div
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am wondering if we can simply more, and get rid of some div and span by adding necessary classes directly to the td element.

className={clsx(
'moonstone-TableCell',
'textAlign' + capitalize(textAlign),
'flexRow',
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need to add gap: var(--spacing-nano) to .moonstone-TableCell

@BouklifYacine BouklifYacine merged commit 04a26c7 into tanstack-table-poc Jan 5, 2026
7 checks passed
@BouklifYacine BouklifYacine deleted the cell-nested-structure branch January 5, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve cell output to avoid having a too-nested structure

3 participants