Skip to content

chore: add React vs WebUI comparison docs#211

Open
janechu wants to merge 4 commits intomainfrom
users/janechu/add-react-vs-custom-elements-docs
Open

chore: add React vs WebUI comparison docs#211
janechu wants to merge 4 commits intomainfrom
users/janechu/add-react-vs-custom-elements-docs

Conversation

@janechu
Copy link
Copy Markdown
Contributor

@janechu janechu commented Apr 10, 2026

Add a new documentation page comparing React (imperative) patterns with their WebUI (declarative) equivalents, covering:

  • Simple counter component (useState vs @observable)
  • Conditional rendering (ternary vs <if>)
  • List rendering (.map() vs <for>)
  • Event handling (@click, w-ref vs onClick, useRef)
  • Parent-child communication (Custom Events vs callback props)
  • Styling (CSS-in-JS vs scoped Shadow DOM CSS)
  • Component composition
  • FAST-HTML alternative syntax
  • Architecture comparison (SPA vs Islands)

Also updates the sidebar config and README.

Closes #192

janechu and others added 2 commits April 9, 2026 20:24
Add a new documentation page at docs/guide/concepts/react-comparison.md
that shows side-by-side Before (React imperative) vs After (WebUI
declarative) examples covering:

- Simple counter component
- Conditional rendering
- List rendering
- Event handling
- Parent-child communication via Custom Events
- Styling (CSS-in-JS vs scoped CSS)
- Component composition
- FAST-HTML alternative syntax
- Architecture comparison (SPA vs Islands)

Add the page to the VitePress sidebar under Guides and link it from
the README.

Closes #192

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Change top heading from 'React vs WebUI' to 'React vs Web Components'
- Include FAST in the opening paragraph
- Remove '(recommended)' labels from WebUI Framework
- Remove recommendation paragraph favoring WebUI over FAST
- Refer to FAST HTML as 'FAST' throughout
- Update sidebar link text and README link

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu marked this pull request as ready for review April 10, 2026 03:35
@janechu janechu requested a review from mohamedmansour April 10, 2026 03:52
@mohamedmansour
Copy link
Copy Markdown
Contributor

@copilot can you update this PR to make them side by side React | WebUI, like a nice table side by side instead of Top/Down

- Add CodeComparison.vue component with left/right named slots and configurable column labels
- Register CodeComparison globally in VitePress theme
- Add .comparison-wrapper CSS grid to custom.css (2-col on desktop, 1-col on mobile)
- Rewrite react-comparison.md to use <CodeComparison> for all 8 comparison sections

Agent-Logs-Url: https://github.com/microsoft/webui/sessions/d5ff1b11-6d95-4582-ad0b-492105b266ec

Co-authored-by: mohamedmansour <68524+mohamedmansour@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented Apr 10, 2026

@copilot can you update this PR to make them side by side React | WebUI, like a nice table side by side instead of Top/Down

Done in commit 4099375. Each section now renders React and WebUI code side by side in a two-column grid layout with labelled column headers. The layout collapses to a single column on mobile. A reusable CodeComparison.vue component was added (with configurable column labels — used for the FAST section too with "WebUI Framework" | "FAST" headers) and registered globally in the VitePress theme.

@mohamedmansour
Copy link
Copy Markdown
Contributor

@copilot some more stuff you can add:

  • make it responsive the code blocks you added
  • Event Handling code, in react you forgot to add performSearch function like the webui code, and for webui, you don't need inputEl at all, you have e.currentTarget that you can get it from.
  • Parent-Child Communication, react has useContext approach that is a fair comparison like https://react.dev/reference/react/useContext since WebUI is doing events similar.

Remember we need them to have equal functionality

Each .comparison-col now has a tinted background matching its label color
- Left (React) column: rgba(97, 218, 251, 0.05) blue tint
- Right (WebUI) column: var(--accent-soft-bg) brand accent tint
- Label uses negative horizontal margin to span full column width over padding
- Column has border-radius and padding so tint shows around code blocks

Agent-Logs-Url: https://github.com/microsoft/webui/sessions/49632ed7-bbf2-471d-8062-969a6a389055

Co-authored-by: mohamedmansour <68524+mohamedmansour@users.noreply.github.com>
@mohamedmansour mohamedmansour requested a review from akroshg April 10, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: we need before and after for imperative frameworks vs declarative

3 participants