Skip to main content

shinyreact shinyreact website

check-py

shinyreact lets you write the UI of a Shiny for Python app as a React client you own, while the Python server contains only reactive computation. It provides the bridge between the two and ships zero UI components itself. The same JavaScript bundle backs the R package, so one React client works against an app.py or an app.R server. The full site covers all three.

Installation

pip install shinyreact

Or install the development version from GitHub:

pip install "git+https://github.com/posit-dev/shinyreact.git"

Usage

set_react_page() discovers www/ui.js (and www/ui.css, if present) next to the app file and serves them as the page. @reactive_output publishes any JSON-serializable value to the client's useShinyOutputValue() hook:

from shiny.express import input
from shinyreact import reactive_output, set_react_page

set_react_page()


@reactive_output
def greeting():
    return f"Hello, {input.name()}!"

In Core mode, page_react() is the ui argument instead:

from shiny import App
from shinyreact import page_react, reactive_output


def server(input, output, session):
    @reactive_output
    def greeting():
        return f"Hello, {input.name()}!"


app = App(page_react(), server)

The matching www/ui.js:

const { React, ReactDOM, useShinyInput, useShinyOutputValue } = window.shinyreact;
const h = React.createElement;

function App() {
  const [name, setName] = useShinyInput("name", "world");
  const greeting = useShinyOutputValue("greeting");
  return h(
    "div",
    null,
    h("input", { value: name, onChange: (e) => setName(e.target.value) }),
    h("p", null, greeting)
  );
}

ReactDOM.createRoot(document.body.appendChild(document.createElement("div"))).render(h(App));

Try a complete app:

git clone https://github.com/posit-dev/shinyreact
shiny run shinyreact/examples/01-hello/app.py

Learn more

  • Get started walks through the ui.tsx pattern: inputs, outputs, messages, and embedding traditional Shiny renderers.
  • TSX files and JavaScript build tools explains .tsx, JSX, TypeScript, and what npm run build does.
  • Client hooks lists everything at window.shinyreact.
  • Testing covers shiny's local_server pytest fixture for driving a server with no browser, and WireTap for wire payloads in Playwright tests.
  • Agent Skills explains the skills that ship with the package for coding agents.
  • The examples catalog lists runnable apps from no-build to Vite + HMR.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shinyreact-0.1.0.tar.gz (114.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shinyreact-0.1.0-py3-none-any.whl (122.0 kB view details)

Uploaded Python 3

File details

Details for the file shinyreact-0.1.0.tar.gz.

File metadata

  • Download URL: shinyreact-0.1.0.tar.gz
  • Upload date:
  • Size: 114.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for shinyreact-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3df1d2f844fa5d3a070738611fa334796e56122e69e2b48f9dd024228403eb97
MD5 167c246ec4061913a6522294113da132
BLAKE2b-256 1491dfc7ababee605370df61e364bda38c8600d5fe9fb2ee010fbf39ce209093

See more details on using hashes here.

Provenance

The following attestation bundles were made for shinyreact-0.1.0.tar.gz:

Publisher: release-py.yaml on posit-dev/shinyreact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shinyreact-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: shinyreact-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 122.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for shinyreact-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31d5c69787274b6455e94386c082e6cc76b0b0526dcd2972029d64b930453962
MD5 27dd99e6264f5a6b8243f4212103f6ff
BLAKE2b-256 ad02c9b5e49461026eedd5728c91fa8e5ef3eb292f0a3ad4d8fa66144fa9905e

See more details on using hashes here.

Provenance

The following attestation bundles were made for shinyreact-0.1.0-py3-none-any.whl:

Publisher: release-py.yaml on posit-dev/shinyreact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page