Created
August 18, 2017 11:59
-
-
Save timwis/8d45100a09d5fb2f64d9b7f8e6f7096f to your computer and use it in GitHub Desktop.
Custom elements with bel (via https://github.com/shama/bel/compare/master...timwis:custom-elements?expand=1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const html = require('bel') | |
window.CustomButton = function (props) { | |
console.log('Called CustomButton', props) | |
return html` | |
<button style="background-color: ${props.color}"> | |
${props.label} | |
</button> | |
` | |
} | |
const tree = html` | |
<div> | |
<CustomButton color="red" label="Add" /> | |
</div> | |
` | |
document.body.appendChild(tree) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment