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

feat: support Component and Element for List props #10539

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

guilbill
Copy link
Contributor

@guilbill guilbill commented Feb 21, 2025

Problem

In order to have a better developper experience we want to simplify the way we customise the List sub-component (eg: actions, filters, aside, pagination).

Solution

Allow to use React.ComponentType in addition to ReactElement.

  const Actions = () => <Box sx={{ backgroundColor: 'info.main' }}>Actions</Box>;
  <List actions={Actions}>
      <BookList />
  </List>

or

    <List
        actions={
            <Box sx={{ backgroundColor: 'info.main' }}>
                Actions
            </Box>
        }
    >
        <BookList />
    </List>

How To Test

Create a List using a component (actions={Actions})

Additional Checks

  • The PR targets master for a bugfix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@guilbill guilbill added the WIP Work In Progress label Feb 21, 2025
@guilbill guilbill force-pushed the support-both-element-and-component-for-list branch from 92437f9 to abf98d3 Compare February 21, 2025 15:24
@guilbill guilbill changed the title feat: support Component and Element as actions prop feat: support Component and Element for List props Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant