A view router for Textual projects
Project description
Textual Router
A view router for Textual inspired by Solid-Router.
Usage
Create Views from Static widgets.
Use the Router object in your App's compose() and provide links and their Views:
yield Router(
[
Route(path="link_to_view_a", view=ViewA()),
Route(path="link_to_view_b", view=ViewB()),
]
)
Within in your View, use RouterLinks to navigate to other views.
yield RouterLink(path="link_to_view_b",label="ViewB")
Full Example
from textual.app import App, ComposeResult
from textual.widgets import Footer, Header, Static
from textual_router import Route, Router, RouterLink
class Home(Static):
def compose(self):
yield RouterLink(path="about", label="About")
class About(Static):
def compose(self):
yield RouterLink(path="home", label="Home")
class BasicApp(App):
TITLE = "Basic app"
def compose(self) -> ComposeResult:
yield Header()
yield Router(
[
Route(path="home", view=Home()),
Route(path="about", view=About()),
]
)
yield Footer()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
textual_router-0.2.2.tar.gz
(3.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textual_router-0.2.2.tar.gz.
File metadata
- Download URL: textual_router-0.2.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d5850050a974cd1b6b45295106c7dede2411541dfb7f9b7d15fc748f795651c
|
|
| MD5 |
a3888d8e9b1516f3c3f5fa4db783dac5
|
|
| BLAKE2b-256 |
36ccb356d39dec2f608fac87f6f97f75be75cfb462cc2e20d94bb9849501ad80
|
File details
Details for the file textual_router-0.2.2-py3-none-any.whl.
File metadata
- Download URL: textual_router-0.2.2-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1ea800ed40644490363f5849bb47f870c697535ee322c8cefd7e09785269c27
|
|
| MD5 |
f4df00e20833ccbc6f2dbfab50380c24
|
|
| BLAKE2b-256 |
a54b273f9b2ae9e5f5826319abe4f5a734a0d1a82aba4105df3e306bc19230e4
|