Getting Started
Welcome to Tan Compose! Build reusable web components with declarative syntax.
<h3>Installationnpm install tan-composecode>
Basic Usage
import { describe, build } from 'tan-compose';
const button = describe({
tag: 'button',
template: 'Click me!',
styles: {
padding: '10px 20px',
backgroundColor: '#007bff',
color: 'white',
border: 'none',
borderRadius: '4px'
},
action: () => alert('Button clicked!')
});
build('my-button', button);
API Reference
Creates a component description object.
>Parameters:
- <
template - Inner HTML contentstyles - CSS styles objecttheme - CSS custom propertieschildren - Nested componentsaction - Click handlerattributes> - HTML attributesbeforeMount/afterMount - Lifecycle hooks>emit - Custom eventsbuild(tagName, description)
>Registers a custom element.
Parameters:
tagName- Custom element name
description - Component descriptionExamples<
h2>See the examples page for interactive demos.