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

Teleport should provide the option to prepend when there are multiple teleports on the same target #7595

Open
1-oh-1 opened this issue Jan 29, 2023 · 1 comment
Labels
✨ feature request New feature or request

Comments

@1-oh-1
Copy link

1-oh-1 commented Jan 29, 2023

What problem does this feature solve?

A simple use case for this feature would be a reusable notification component, that is teleported to a notification-panel component. Ideally, the notification would live in the component that is responsible for its generation, then be teleported to the notification-panel which could contain several notifications simultaneously. In this scenario, it makes sense for the latest notification to be prepended to the top of the notification-panel, rather than being appended to the bottom.

What does the proposed API look like?

A prepend boolean prop on the teleport component (which defaults to false) would be an ideal solution from my perspective.

<teleport to="body" :prepend="true"></teleport>

A more complex alternative solution would be something akin to the order prop used in the portal-vue library, where the render order can be dynamically controlled using an numeric order prop on the teleport component.

<teleport to="body" :order="1"></teleport>
<teleport to="body" :order="-1"></teleport>
@1-oh-1 1-oh-1 added the ✨ feature request New feature or request label Jan 29, 2023
@YoSev
Copy link

YoSev commented Nov 8, 2024

Replacing existing content with :replace="true" would also be appreciated.
Content of teleport targets can thus be used as we use default values in slots.

(I am aware this can be achieved using vanillajs manually)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants