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

[PageContainer] Add a few extra slots or allow complete override of title #4511

Open
mkarajohn opened this issue Dec 5, 2024 · 5 comments
Open
Labels
component: PageContainer customization: dom Component's DOM customizability, e.g. slot scope: toolpad-core Abbreviated to "core"

Comments

@mkarajohn
Copy link

mkarajohn commented Dec 5, 2024

Summary

PageContainer could use a few extra slots:

preTitle : an element that is placed immediately before the h# element that contains the title
postTitle : an element that is placed immediately after the h# element that contains the title.

preTitle, title, postTitle should wrap into new rows in smaller widths

These should be siblings to the h#, not children

An alternative approach would be to allow a ReactNode for the title prop (or turn it into a slot?), in which case it's up to the user to implement the HTML structure correctly, and the PageContainer simply renders it in place of where it's currently rendering <h#>{title}</h#>, completely replacing this with whatever the user passed as title.

If a string is passed as title then it works like it does now.

Examples

e.g.
I need to add an icon before the title and some extra information after it.

Motivation

Needing to achieve something like this:
image

Search keywords: PageContainer, title, customization

@mkarajohn mkarajohn added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 5, 2024
@apedroferreira apedroferreira added scope: toolpad-core Abbreviated to "core" component: PageContainer good first issue Great for first contributions. Enable to learn the contribution process. customization: dom Component's DOM customizability, e.g. slot and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 5, 2024
@apedroferreira
Copy link
Member

I think we could add a single slot that replaces the whole title, and call it title? Feel free to open a PR!

@timurridjanovic
Copy link

Could we also allow the user to add an href or segment to link to somewhere else than just "/" ?

@bharatkashyap
Copy link
Member

Could we also allow the user to add an href or segment to link to somewhere else than just "/" ?

This is being worked on here: #4477

@bharatkashyap
Copy link
Member

Does the new appTitle slot (https://mui.com/toolpad/core/react-dashboard-layout/#slots) help solve your need?

@bharatkashyap bharatkashyap added status: waiting for author Issue with insufficient information and removed good first issue Great for first contributions. Enable to learn the contribution process. labels Dec 16, 2024
@mkarajohn
Copy link
Author

Hello, sorry for the late response but I do not have much spare time.

@bharatkashyap yes, something like this but for PageContainer not DashboardLayout

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Dec 16, 2024
@bharatkashyap bharatkashyap removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: PageContainer customization: dom Component's DOM customizability, e.g. slot scope: toolpad-core Abbreviated to "core"
Projects
None yet
Development

No branches or pull requests

4 participants