Type: Package
Title: 'React Router' for 'shiny' Apps and 'Quarto'
Version: 0.1.1
Maintainer: Felix Luginbuhl <felix.luginbuhl@protonmail.ch>
Description: You can easily share url pages using 'React Router' in 'shiny' applications and 'Quarto' documents. The package wraps the 'react-router-dom' 'React' library and provides access to hash routing to navigate on multiple url pages.
License: MIT + file LICENSE
Encoding: UTF-8
Depends: R (≥ 3.4)
Imports: htmltools, shiny, shiny.react, checkmate, uuid
Suggests: testthat (≥ 3.0.0), chromote (≥ 0.1.1.9001), shinytest2, knitr, rmarkdown
RoxygenNote: 7.3.2
URL: https://felixluginbuhl.com/reactRouter/
BugReports: https://github.com/lgnbhl/reactRouter/issues
Config/testthat/edition: 3
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-07-23 14:05:29 UTC; felix
Author: Felix Luginbuhl ORCID iD [aut, cre], Andryas Waurzenczak [ctb], Shopify Inc. [ctb, cph] (Shopify Inc. template <https://reactrouter.com/>)
Repository: CRAN
Date/Publication: 2025-07-23 14:30:02 UTC

BrowserRouter

Description

https://reactrouter.com/6.30.0/router-components/browser-router

Usage

BrowserRouter(...)

Arguments

...

Props to pass to element.

Value

A BrowserRouter component.


HashRouter

Description

https://reactrouter.com/6.30.0/router-components/hash-router

Usage

HashRouter(...)

Arguments

...

Props to pass to element.

Value

A HashRouter component.


Description

The 'reloadDocument' can be used to skip client side routing and let the browser handle the transition normally (as if it were an <a href>). Given shiny behavior, using 'reloadDocument = TRUE' allows to render correctly objects created in the server side.

https://reactrouter.com/6.30.0/components/link

Usage

Link(..., reloadDocument = TRUE)

Link.shinyInput(inputId, ..., reloadDocument = TRUE)

updateLink.shinyInput(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  ...
)

Arguments

...

Props to pass to element.

reloadDocument

Boolean. Default TRUE. Let browser handle the transition normally

inputId

ID of the component.

session

Object passed as the 'session' argument to Shiny server.

Value

A Link component.


MemoryRouter

Description

https://reactrouter.com/6.30.0/router-components/memory-router

Usage

MemoryRouter(...)

Arguments

...

Props to pass to element.

Value

A MemoryRouter component.


Description

The 'reloadDocument' can be used to skip client side routing and let the browser handle the transition normally (as if it were an <a href>). Given shiny behavior, using 'reloadDocument = TRUE' allows to render correctly objects created in the server side.

https://reactrouter.com/6.30.0/components/nav-link

Usage

NavLink(..., reloadDocument = TRUE)

NavLink.shinyInput(inputId, ..., reloadDocument = TRUE)

updateNavLink.shinyInput(
  session = shiny::getDefaultReactiveDomain(),
  inputId,
  ...
)

Arguments

...

Props to pass to element.

reloadDocument

Boolean. Default TRUE. Let browser handle the transition normally

inputId

ID of the component.

session

Object passed as the 'session' argument to Shiny server.

Value

A NavLink component.


Description

https://reactrouter.com/6.30.0/components/navigate

Usage

Navigate(...)

Arguments

...

Props to pass to element.

Value

A Navigate component.


Outlet

Description

https://reactrouter.com/6.30.0/components/outlet

Usage

Outlet(...)

Arguments

...

Props to pass to element.

Value

A Outlet component.


Route

Description

https://reactrouter.com/6.30.0/components/route

Usage

Route(..., element, key = uuid::UUIDgenerate())

Arguments

...

Props to pass to element.

element

element wrapped in a 'shiny::div()'.

key

By default uses a UUID key in the 'div()' of the 'element' arg.

Details

Internally the 'element' is wrapped in a 'shiny::div()' with a UUID key so, in case R shiny is used, shiny can differentiate each element.

Value

A Route component.


Routes

Description

https://reactrouter.com/6.30.0/components/routes

Usage

Routes(...)

Arguments

...

Props to pass to element.

Value

A Routes component.


Documentation template for components

Description

Documentation template for components

Arguments

...

Props to pass to the component. The allowed props are listed below in the Details section.

Value

Object with 'shiny.tag' class suitable for use in the UI of a Shiny app.


react-router-dom JS dependency

Description

react-router-dom JS dependency

Usage

reactRouterDependency()

Value

HTML dependency object.


Run reactRouterExample example

Description

Launch a Shiny example app or list the available examples. Use 'reactRouter::reactRouterExample("basic")' to run a showcase app.

Usage

reactRouterExample(example = NULL, ...)

Arguments

example

The name of the example to run, or 'NULL' to retrieve the list of examples.

...

Additional arguments to pass to 'shiny::runApp()'.

Value

This function normally does not return; interrupt R to stop the application (usually by pressing Ctrl+C or Esc).

See Also

[shiny.blueprint::runExample()] which this function is an adaptation.


Objects exported from other packages

Description

These objects are imported from other packages. Follow the links below to see their documentation.

shiny.react

JS