Scoping styles inside components

UI Components for Vue
Post Reply
alayadesignsystem
Posts: 4
Joined: 31 Jan 2022, 23:26

26 May 2022, 21:52

Is there a reason styles are not scoped in the components? I think this is fine for 99% of people using PrimeVue, but I think this could cause issues for companies with a microfrontend architecture because micro frontends could have a different version of primevue and the styles from a micro frontend could affect the other.

Example of what it is right now:
<style>
.p-autocomplete {
display: inline-flex;
position: relative;
}
</style>

Example of what I think it should be:
<style scoped>
.p-autocomplete {
display: inline-flex;
position: relative;
}

</style>
Deep selector can be used to affect the styles of child components.

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

01 Jul 2022, 13:42

I agree. It possible for all libraries not just PrimeVue. As you could see in the docs, there is `appendTo` property and the default value is 'body'. Scope styling wont' be the ultimate solution.

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

26 Jul 2022, 13:35

Thanks for the great explanation. It would be very useful for the community.

We're open the new ideas to add some styles for components that appended the body.

Skalla
Posts: 4
Joined: 03 Jun 2023, 10:15

03 Jun 2023, 10:45

What about appendTo in SideBar? It seems the SideBar can only live on the body? In my case I want it on a custom div.

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

14 Aug 2023, 11:29

There is a new 'pt' property for this purpose. For example: https://primevue.org/sidebar/#pt.demo

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests