You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rfcs/2024-05-21-ui-component-model.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,11 @@ Context: converge on a default UI component model for LLM-generated UI.
20
20
### Technical goals
21
21
22
22
- Components are **encapsulated**
23
-
- A component may control its child tree, but not its siblings or parent
24
-
- Components are **black boxes**, with inputs and outputs
23
+
- A component may control its child tree, but not its siblings or parent
25
24
- Components have **inputs**, and **output UI** and **events**
26
25
- Are pure-ish functions of state (we may allow cheats for local component state ala hooks)
26
+
- Components are **black boxes**
27
+
- Components are decoupled and only communicate via input and output channels.
27
28
- Component **inputs** and **outputs** are **statically-typed**
28
29
- E.g. via TypeScript
29
30
- Allows the runtime to enforce data policies on component
@@ -38,7 +39,7 @@ Context: converge on a default UI component model for LLM-generated UI.
38
39
- Note: in something like the Elm App Architecture Pattern, Models, Views, and Update functions are “zippered” together, meaning components are “some assembly required”. This would fall short of this goal without some additional means of making an individual component free-standing.
39
40
- Components are **composable**
40
41
- Components can be combined together like lego to create larger components
41
-
-Composition should involve plugging together component inputs, outputs, and events, and arranging a UI tree. It shouldn’t be more complicated than that.
42
+
-Composing plugins should be as easy as plugging together component inputs, outputs, and events, and arranging a UI tree. It shouldn’t be more complicated than that.
42
43
- Components can have **holes**, allowing you to slot in an arbitrary component of the right shape.
43
44
- Inversion of control for templates.
44
45
- The shape of the hole is determined by the data’s input and output types
@@ -47,10 +48,14 @@ Context: converge on a default UI component model for LLM-generated UI.
47
48
-[passing down closures that evaluate to components](https://swiftwithmajid.com/2019/11/06/the-power-of-closures-in-swiftui/)
- Components have **[high locality of behavior](https://github.com/gordonbrander/generative-ui-playbook?tab=readme-ov-file#llms-work-best-with-high-locality)**
51
+
- Components are relatively **small**
52
+
- LLMs will have higher accuracy generating small islands of interactivity vs whole apps
53
+
- Small composable components are easier to understand and debug
50
54
- UI **templates** are **pure functions of state**
51
55
- Templates take inputs, and output a UI tree and events
52
56
- Templates produce a UI tree that is easy for the runtime to analyze and sanitize (probably a VDOM, probably not raw DOM).
53
-
- Components can be rendered on the web platform
57
+
- Components are renderable to web
58
+
- Other platforms may be supported in future, but web platform is primary
0 commit comments