pebble / clay

Pebble Config Framework
MIT License
121 stars 29 forks source link

Set CSS style of element #144

Closed hitormiss closed 8 years ago

hitormiss commented 8 years ago

I'm trying to set a CSS property for a text component, but it doesn't appear to be working.

The documentation for Minified suggests the following should work, but it just sets the innerHTML for the component to "$overflowWrap"

clayConfig.getItemById('ConfigString').set('$overflowWrap','break-word');

I also tried the following, but it appears to just set the innerHTML to the Variable without including the surrounding .

clayConfig.getItemById('ConfigString').set('<span style="overflow-wrap: break-word;">' + ConfigString + '</span>');

keegan-lillo commented 8 years ago

configItem is not a Minifed list. The .set() method sets the value of the item. what you want is:

clayConfig.getItemById('ConfigString').$element.set('$overflowWrap','break-word');

Have a look at the docs here: https://github.com/pebble/clay#clayitem-object-config-