From 42fa0341b36eb54710c28a0f069623c2473f6332 Mon Sep 17 00:00:00 2001 From: Damir Date: Wed, 19 Oct 2022 04:31:30 +0200 Subject: [PATCH] Update readme --- readme.md | 116 ++++++++++++++++++++++---------------------- src/index.js | 20 ++++++-- test/test-locals.js | 8 +-- test/test-slots.js | 16 +++--- 4 files changed, 85 insertions(+), 75 deletions(-) diff --git a/readme.md b/readme.md index 6d58df8..43c0435 100644 --- a/readme.md +++ b/readme.md @@ -26,8 +26,8 @@ Create the component: ``` html - ``` @@ -37,7 +37,7 @@ Use the component: - Submit + Submit ``` @@ -62,42 +62,65 @@ Result: - + ``` +You may ask yourself many questions about this basic examples, and you will find most if not all answers in this readme. In case is missing something, feel free to ask via discussions. + +But I want to explain a few things now. + +First you may notice that our `src/button.html` component has a `type` and `class` attribute, and when we use the component in `src/index.html` we add type and class attribute. The result is that `type` is override, and `class` is merged. + +By default `class` and `style` attributes are merged, while all others attribute are override. You can also override class and style attribute by prepending `override:` to the class attribute. Example: + +```html +Submit + + + +``` + +All attributes you pass to the component will be added to the first root element of your component, and only if they are not defined as `props` via `