posit-dev / posit-dev/shinyreact
Add helper React components that wrap ShinyOutput with sensible defaults per output type
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 14
- Forks
- 3
- Avg merge
- 9h 12m
- Merged PRs (30d)
- 74
Description
ShinyOutput is intentionally generic — callers must know the right tagName, className, and any DOM expectations for each Shiny output type (plot, image, htmlwidget, ipywidget, data frame, UI, etc.). That knowledge currently lives in user code and example READMEs, e.g.:
// plotly / ipywidget
h(ShinyOutput, {
id: "scatter",
className: "shiny-ipywidget-output shiny-report-size",
style: { width: "100%", height: "100%" },
});
// data frame
h(ShinyOutput, { id: "my_table", tagName: "shiny-data-frame" });
We should ship a small set (likely <10) of thin wrappers that encode those defaults so call sites read like:
<ShinyPlotOutput id="my_plot" />
<ShinyImageOutput id="my_img" />
<ShinyHtmlOutput id="dyn_ui" /> // renderUI / output_ui
<ShinyTableOutput id="tbl" /> // renderTable
<ShinyDataFrameOutput id="df" /> // <shiny-data-frame>
<ShinyHtmlWidgetOutput id="map" /> // htmlwidgets (leaflet, DT, etc.)
<ShinyIPyWidgetOutput id="plot" /> // shinywidgets / plotly / ipywidgets
Each is a one-liner over ShinyOutput setting the correct tagName / className / structural classes (shiny-report-size, html-widget-output, etc.) and forwarding remaining props. Generic ShinyOutput stays as the escape hatch for anything not covered.
(Text/print outputs don't need a wrapper — the generic ShinyOutput is already sufficient.)
Scope
- Identify the canonical DOM signature for each output type (read Shiny's
output_*HTML, htmlwidgets binding, shinywidgets binding) and document it next to each wrapper. - Export from
window.shinyreactand the TS types alongsideShinyOutput. - Update
examples/ui-tsx/06-data-frameand07-plotlyto use the new wrappers. - Add Playwright e2e coverage following
pkg-py/tests/playwright/apps/{plotly,data_frame}patterns.
Open questions
- Naming:
ShinyPlotOutputvsPlotOutput(do we want theShinyprefix on all of them, given they live underwindow.shinyreact.*)? - Do htmlwidgets need one wrapper or one per widget family (leaflet differs from DT)? Probably one generic
ShinyHtmlWidgetOutputis enough — htmlwidgets uses a uniform binding. - Should wrappers default a
style={{ width: "100%", height: "100%" }}or leave sizing to the caller?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing ShinyOutput component, its TypeScript exports, and the canonical output HTML, htmlwidgets binding, and shinywidgets binding. Compare those signatures with examples/ui-tsx/06-data-frame, examples/ui-tsx/07-plotly, and the pkg-py/tests/playwright/apps/plotly and data_frame patterns. Done means the wrappers, window.shinyreact exports, TS types, example updates, and Playwright coverage agree on the documented defaults.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, react, typescript
- Domain
- frontend, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100