Skip to content

Commit 5b53824

Browse files
committed
Some fixes to ai html components guideline
1 parent 7e1c7ca commit 5b53824

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

ai/HTML_COMPONENTS.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
---
99

10-
**Note:** This file is formatted in Markdown. All content, including headings, code blocks, and inline formatting, must be parsed and interpreted according to Markdown syntax rules rather than treated as plain text.
10+
**Note:** This file is formatted in Markdown. All content, including headings, code blocks, and inline formatting, must be parsed and interpreted according to Markdown syntax rules rather than treated as plain text. Read this file twice to avoid making mistakes.
1111

1212
---
1313

@@ -134,8 +134,9 @@ def on_parent(self, parent):
134134
```
135135

136136
### `on_root_finalized(root)`
137-
Called once the root component (usually the Page) is permanently set.
138-
Use this to bind events if you require a stable root i.e. the Page component.
137+
Called once the root component (usually the Page) is permanently set.
138+
139+
You can use this to bind events if you require a stable root i.e. the Page component.
139140

140141
```python
141142
def on_root_finalized(self, root):
@@ -157,6 +158,8 @@ Component() ➝‬ on_create() ➝‬ [added to parent] ➝‬ on_parent() ➝
157158
**Always pass everything at construction time via kwargs.** Do not set
158159
attributes after construction unless inside a lifecycle method.
159160

161+
### Correct way:
162+
160163
```python
161164
# CORRECT — clean, declarative
162165
card = Card(
@@ -169,7 +172,11 @@ card = Card(
169172
Paragraph(text="Some description here."),
170173
]
171174
)
175+
```
172176

177+
### Wrong way:
178+
179+
```python
173180
# WRONG — imperative, scattered
174181
card = Card()
175182
card.id = "featured-card"

0 commit comments

Comments
 (0)