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

[question] How to use custom components in my design? #295

Open
amyfourie opened this issue Jan 18, 2024 · 7 comments
Open

[question] How to use custom components in my design? #295

amyfourie opened this issue Jan 18, 2024 · 7 comments
Assignees
Labels
support: question Community support but can be turned into an improvement

Comments

@amyfourie
Copy link

amyfourie commented Jan 18, 2024

The problem in depth

I'd like to add the custom component "toolbar" in my design. I'd like to add it to a card along with the table component (similar to the mockup in the library file). When I search for it on the right hand side it doesn't appear and I can't seem to paste it into the card. Could you help?

Your environment

MUI 5.15.0

Search keywords:

@amyfourie amyfourie added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: question Community support but can be turned into an improvement labels Jan 18, 2024
@amyfourie
Copy link
Author

amyfourie commented Jan 19, 2024

The same issue but different example: I'd like to add an icon into the dialog component in the top right. How do I do this?

@adrianmanea
Copy link
Collaborator

adrianmanea commented Jan 19, 2024

Hi Amy, the reason you cannot add a Table is (probably) because the Card is still an Instance. If that's the case, there are two options here, one would be to detach the Card instance and freely add any components inside it and the second (a bit more complex) solution would be to replace the instance inside the Card with a Table.

Let me know if you need me to record a quick 1 minute demo of both solutions.

@amyfourie
Copy link
Author

amyfourie commented Jan 19, 2024 via email

@zannager zannager removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 22, 2024
@adrianmanea
Copy link
Collaborator

Hi Amy, yes you can add multiple components using the <Stack> component inside an instance!

@amyfourie
Copy link
Author

amazing! thanks so much

@amyfourie
Copy link
Author

Apologies, is it possible to add more than 5 instance slots?

@amyfourie amyfourie reopened this Jan 24, 2024
@adrianmanea
Copy link
Collaborator

adrianmanea commented Jan 25, 2024

Hi Amy, yes, it's possible. When you select the 5+ variant, you'll reveal five additional hidden instances (refer to the attached screenshot).

However, I would suggest a different approach. Instead of building with <Stack>, consider defining a custom component and swapping that in (see attached).

image
MUI.F.Replace.Whole.Instance.mov

@danilo-leal danilo-leal changed the title Using custom components in my design [question] How to use custom components in my design? Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

3 participants