Skip to content

Commit d54b998

Browse files
authored
Update elements_docs.md with usage examples
Added code examples for basic usage and advanced component.
1 parent 6eed2cf commit d54b998

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/gp2/elements_docs.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This is the custom rendering engine for Random Rants +. It allows us to build th
77

88
## 🚀 Basic Usage
99
To create an element, pass an array of objects to elements.createElementsFromJSON().
10-
10+
```javascript
1111
const elements = require('./gp2/elements.js');
1212

1313
const myUI = elements.createElementsFromJSON([
@@ -29,6 +29,7 @@ const myUI = elements.createElementsFromJSON([
2929
]);
3030

3131
document.body.append(...myUI);
32+
```
3233

3334
---
3435

@@ -48,6 +49,7 @@ document.body.append(...myUI);
4849
## 🛠 Advanced Example: Interactive Component
4950
Use GPWhenCreated and eventListeners to make things interactive.
5051

52+
```javascript
5153
const chatInput = elements.createElementsFromJSON([
5254
{
5355
element: "input",
@@ -65,6 +67,7 @@ const chatInput = elements.createElementsFromJSON([
6567
}
6668
}
6769
]);
70+
```
6871

6972
---
7073

0 commit comments

Comments
 (0)