Common StarHTML Syntax Patterns

This is correct syntax

Children come first

Pattern 1: Attributes Last

All children first

Then all attributes

Pattern 2: Nested Structure

Inner content here

Pattern 3: Component Functions

Extract complex structures into functions

This makes the code cleaner and avoids syntax issues


# WRONG - SyntaxError:
# Div(id="test", P("content"), style="...")

# CORRECT - Attributes after children:
# Div(P("content"), id="test", style="...")

# WRONG - Mixing positions:
# Button("Click", id="btn", Icon("arrow"), cls="primary")

# CORRECT - All children first:
# Button("Click", Icon("arrow"), id="btn", cls="primary")