<div [width:20px]>
You can even do hover states in an inline style: <div [color:red @hover:blue]>
And interpolation is easy too: <div [width:{someValue}px]>
Putting a CSS block at any level of your tag hierarchy scopes it to that tag. <div.foo>
<div.bar>
css color:red # this applies to div.bar
em color:blue # this applies to div.bar em
"hello"
<em> "world"
CSS blocks declared in a component definition but outside of the markup, apply to the whole tag. CSS declared in a file, outside of a component definition, apply to all components defined in that file. There is also a global keyword to apply styles globally. c:red # same as color:red
d:vtc # same as display:flex flex-direction:column justify-content:center
x:10px rotate:30deg # same as transform:translateX(10px), rotate(30deg) tag Counter
count = 0
<self @click=(count++)> "count: {count}" css div { background-color: red; display: flex; flex-direction: column; }
div@hover {background-color:blue;}
css div background-color: red display: flex flex-direction: column
div@hover background-color: blue
css div bgc:red @hover:blue d:vflex let count = 0
tag Counter
<self @click=(count++)> "Count is: {count}"
imba.mount <Counter>, document.body let count = 0
def increment
count++
tag App
<self>
<button @click=increment> "Increment"
<div> "Count: {count}"
imba.mount <App>
Try this example here: https://scrimba.com/scrim/cpbmKzsq