Issue #2544Opened February 2, 2020by gentritabazi3 reactions

Get CSS of selected component ?

Question

Hello how can i get css of selected component ?

Answers (3)

longdoan7421February 3, 20203 reactions

You could listen the event component:selected, then you could get the component's DOM element from that. Afterwards, you could simply use javascript to get style of that component. About getting style by javascript, you can check this link How to get CSS values in JavaScript

Here is an example:

editor.on('component:selected', (component) => {
  const domElement = component.getEl();
  const style = window.getComputedStyle(domElement)
})
artfFebruary 3, 20200 reactions

You can also get the currently selected component by doing editor.getSelected()

alemencionesMarch 9, 20200 reactions

How to get/setStyle() of hover state from a component? this is posible?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.