Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enableCellHoverReveal column option #429

Merged
merged 13 commits into from
Dec 13, 2024

Conversation

laratran
Copy link
Contributor

@laratran laratran commented Oct 28, 2024

Usage

const Example = () => {
  const columns = useMemo<MRT_ColumnDef<Person>[]>(
    () => [
      {
        accessorKey: 'firstName',
        header: 'First Name',
      },
      {
        accessorKey: 'lastName',
        header: 'Last Name',
      },
      {
        accessorKey: 'email',
        header: 'Email',
        enableCellHoverReveal: true,
        size: 75
      },
      {
        accessorKey: 'city',
        header: 'City',
      },
    ],
    [],
  );

  const table = useMantineReactTable({
    columns,
    data,
    layoutMode: 'grid'
  });

  return <MantineReactTable table={table} />;
};

basic table

image

highlightOnHover: false

image

striped: true

image

Limitations

passing props through mantineTableBodyCellProps

Passing some props through mantineTableBodyCellProps might not work as expected.
For example, passing align:'right' to mantineTableBodyCellProps is not applied on cells that have the hover reveal enabled
Below, all cells are right aligned except for the ones that have overflow.

image

Copy link

vercel bot commented Oct 28, 2024

@laratran is attempting to deploy a commit to the Kevin Vandy OSS Team on Vercel.

A member of the Team first needs to authorize it.

@laratran laratran changed the title Add enable cell hover reveal Add enableCellHoverReveal column option Oct 28, 2024
@laratran laratran force-pushed the add-enable-cell-hover-reveal branch from ac34389 to c9855bc Compare October 29, 2024 19:07
@laratran laratran marked this pull request as ready for review October 31, 2024 16:02
@alessandrojcm
Copy link
Collaborator

LGTM, even works with virtualization! However, could you please 1) Add a storybook example for this? 2) Add the limitations somewhere in the docs? (Maybe in the props description) cc @posabsolute

@alessandrojcm
Copy link
Collaborator

Also please rebase with the latest v2 as I have merged some stuff

@laratran laratran force-pushed the add-enable-cell-hover-reveal branch from 7622f57 to 705005e Compare December 10, 2024 16:45
Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mantine-react-table ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 5:12pm
mantine-react-table-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 5:12pm

@alessandrojcm
Copy link
Collaborator

Great, thanks!

@alessandrojcm alessandrojcm merged commit 0eb109c into KevinVandy:v2 Dec 13, 2024
0 of 3 checks passed
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.

2 participants