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
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,42 +19,43 @@ Context: converge on a default UI component model for LLM-generated UI.
19
19
20
20
### Technical goals
21
21
22
-
- Components are **encapsulated**
22
+
- Components are **encapsulated** (P1)
23
23
- A component may control its child tree, but not its siblings or parent
24
-
- Components have **inputs**, and **output UI** and **events**
25
-
- Components are pure-ish functions of state (we may allow cheats for local component state ala hooks)
24
+
- Components have **inputs**, and **output UI** and **events** (P1)
25
+
- Components can be understood as pure-ish functions that receive props and return a view description (we may allow cheats for local component state ala hooks)
26
26
- Components are **black boxes**
27
27
- Components are decoupled and only communicate via input and output channels.
28
-
- Component **inputs** and **outputs** are **statically-typed**
28
+
- Component **inputs** and **outputs** are **statically-typed** (P1)
29
29
- E.g. via TypeScript
30
30
- Allows the runtime to enforce data policies on component
31
-
- Components have **local state**
31
+
- Components have **local state** (P1)
32
32
- State is encapsulated within component
33
33
- Components may pass state down to child components as input
34
34
- E.g. the React **[“lifting state up” pattern](https://legacy.reactjs.org/docs/lifting-state-up.html)**.
35
35
- Local state may be **persisted**.
36
36
- If it isn’t, it is **ephemeral**, and lasts for the lifetime of the component.
37
-
- Components are **islands**
37
+
- Components are **islands** (P1)
38
38
- Components can be used free-standing, or within a larger component tree.
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.
40
-
- Components are **composable**
39
+
- Note: this is in contrast to something like the Elm App Architecture Pattern, where 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 a free-standing island.
40
+
- Components are **composable** (P1)
41
41
- Components can be combined together like lego to create larger components
42
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.
43
-
- Components can have **holes**, allowing you to slot in an arbitrary component of the right shape.
43
+
- Components can have **holes**, allowing you to slot in an arbitrary component of the right shape. (P1)
44
44
- Inversion of control for templates.
45
45
- The shape of the hole is determined by the data’s input and output types
- Components have **[high locality of behavior](https://github.com/gordonbrander/generative-ui-playbook?tab=readme-ov-file#llms-work-best-with-high-locality)**
50
+
- Components have **[high locality of behavior](https://github.com/gordonbrander/generative-ui-playbook?tab=readme-ov-file#llms-work-best-with-high-locality)** (P1)
51
+
- All component behavior is colocated, including structure, style, and behavior
51
52
- Components are relatively **small**
52
53
- LLMs will have higher accuracy generating small islands of interactivity vs whole apps
53
54
- Small composable components are easier to understand and debug
54
-
- UI **templates** are **pure functions of state**
55
+
- UI **templates** are **pure functions** (P1)
55
56
- Templates take inputs, and output a UI tree and events
56
57
- Templates produce a UI tree that is easy for the runtime to analyze and sanitize (probably a VDOM, probably not raw DOM).
57
-
- Components are renderable to web
58
+
- Components are renderable to web (P1)
58
59
- Other platforms may be supported in future, but web platform is primary
0 commit comments