Getting started with Atomico
This guide will know the essentials to start developing webcomponents with Atomico
// Imports
import { c, css } from "atomico";
// Creating Our Web Component: Custom Element Definition
export const MyComponent = c(
// Defining Component Render Function
({ message }) => {
return <host shadowDom>{message}</host>;
},
{
// Defining Component Properties(props) and Attributes
props: {
message: String,
},
// Defining Encapsulated Styles for the Component
styles: css`
:host {
font-size: 30px;
}
`,
}
);
// Web Component Registration and Definition
customElements.define("my-component", c(component));1.0 Imports
2.0 Creating Our Web Component: Custom Element Definition
2.1 Defining Component Render Function
2.2 Defining Component Properties(props) and Attributes
2.3 Defining Encapsulated Styles for the Component
Web Component Registration and Definition
Example
Last updated
Was this helpful?
