Styling your components
CSS
import { Component, html } from 'vistajs/dom';
import { bootstrap } from 'vistajs/boot';
// Just import your styles
import './styles.css'
const App = Component('my-component', () => {
return () => html`<button>Hello World</button>`;
})
const root = document.querySelector('#root') as Element;
bootstrap(root, App).button {
border: 0;
padding: 0.5rem 1rem;
background-color: #000;
color: #fff;
border-radius: 0.25rem;
}CSS Modules
import { Component, html } from 'vistajs/dom';
import { bootstrap } from 'vistajs/boot';
// Just import your styles, reminding of naming it with *.module.css
import styles './styles.module.css'
const App = Component('my-component', () => {
return () => html`<button class='${styles.button}'>Hello World</button>`;
})
const root = document.querySelector('#root') as Element;
bootstrap(root, App).button {
border: 0;
padding: 0.5rem 1rem;
background-color: #000;
color: #fff;
border-radius: 0.25rem;
}Going further
Last updated