hakhsin's avatar

Best practice for implement two direction components

Hi, what is the best practice for implement a vue component library with two direction? Is the best way to create two css style?

0 likes
1 reply
bobbybouwmann's avatar
Level 88

Mmh it depends a bit on your needs. If it's for example only a few colors you can get away with dynamically setting a base class on the component and let all the other styles depend on that. This way you might have some duplicated CSS in your component which is fine.

Another solution is having everything as a computed property, but this is only recommended with advanced layouts. Here is a possible solution for an advanced layout: https://forum.vuejs.org/t/how-do-i-load-variations-of-a-components-styling-into-an-instance-of-that-component/13075/11

1 like

Please or to participate in this conversation.