Directory

← Back

CssPrime

ClientSide component for inject dynamic css style rule

Author

Contributors

Rating

UI Extension for adding and managing css rules.

Extension create map for css rule in shared state. Adds a style branch to the head section of the HTML source code Allows you to update selected css rules

Sample code

--add extensio to ui
UI ui = UI.getCurrent();
CssPrime css = new CssPrime(ui);
...
css.setSyle(<style rule>);
css.setSyle(<rule key>,<style rule>);

-- append rule
css.setStyle("div{background:red;}"); //add rule with default key
css.setStyle("MyBackground","div{background:red;}");

-- update rule
css.setStyle("div{background:red;}"); //update rule with default key
css.setStyle("MyBackground","div{background:blue;}");

-- remove rule
css.removeStyle; //remove rule with default key
css.removeStyle("MyBackground"); 

--remove extensio from ui
UI.getCurrent().removeExtension(cssPrime);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2017-06-04
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Browser
N/A
Online