Skip to content

Instantly share code, notes, and snippets.

@lega911
Created September 25, 2020 18:47
Show Gist options
  • Save lega911/17df015f3f9dfb1ed14832de4fb97fbf to your computer and use it in GitHub Desktop.
Save lega911/17df015f3f9dfb1ed14832de4fb97fbf to your computer and use it in GitHub Desktop.
Example how to pass CSS-class to child component
<script>
import Icon from './Icon.xht';
let name = 'world';
</script>
<Icon />
<Icon .icon="green bold" />
<br/>
<Icon .icon="aqua big" />
<style>
.aqua {
stroke: cornflowerblue;
fill: aqua;
}
.green {
fill: lightgreen;
stroke: darkgreen;
}
.bold {
stroke-width: 8;
}
.big {
width: 200px;
height: 200px;
}
</style>
<svg class="icon" width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<path d="M 10,30
A 20,20 0,0,1 50,30
A 20,20 0,0,1 90,30
Q 90,60 50,90
Q 10,60 10,30 z" />
</svg>
<style>
:export(.icon) {
stroke: red;
fill: hotpink;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment