Route
A route tells Solara which component to render for a given URL. (Not a Solara component!)
class Route:
path: str
children: List["Route"] = dataclasses.field(default_factory=list)
# these are free to use, depending on the implementation
# see autorouting.py for how Solara uses them
module: Optional[ModuleType] = None
# in the autorouting implementation, this is the
# the same as module.Page (unless we are rendering a markdown)
component: Union[None, Callable, reacton.core.Component] = None
layout: Union[None, Callable, reacton.core.Component] = None
# in the autorouting implementation, this is the
# path of the markdown file
data: Any = None
# Can be used for a title and/or a tab label
label: Optional[str] = None
# file corresponding to this route, can be used for
# checking of content has changed (using mtime)
file: Optional[Path] = None
...
Arguments
path
- The path of the route. This is the part of the URL that you see in the browser.children
- (Optional) A list of child routes. These are routes that are nested under this route.module
- (Optional) The module that contains the component to render for this route, used for autorouting.component
- (Optional) The component to render for this route.layout
- (Optional) The layout to use for this route. If not specified, the default layout will be used.data
- (Optional) The data to pass to the component for this route, usage is up to the user.label
- (Optional) The label to use for this route, can be used for labeling tabs or links.
See also
Example
Click on one of the links below to change the route and see the url in your browser change, and match the route.