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.1.tar.gz
(2.9 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.1.tar.gz.
File metadata
- Download URL: textual_router-0.2.1.tar.gz
- Upload date:
- Size: 2.9 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 |
ed18ed4e841ee2fbd5901af3ff817d7c85d9ad5329496ff266f8ac2822554c40
|
|
| MD5 |
53ea0cd5fc860ef9596376fe0d574fc4
|
|
| BLAKE2b-256 |
686ee0ac32b5fcd15ab811aee8932709f1f0bf4678fe3e19091e53182e66f5a6
|
File details
Details for the file textual_router-0.2.1-py3-none-any.whl.
File metadata
- Download URL: textual_router-0.2.1-py3-none-any.whl
- Upload date:
- Size: 3.5 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 |
df7080118fbf880cdea380c8f0f6132cc4bffe1eed9284d4097d60e739c3004f
|
|
| MD5 |
314b0b5edc830be6d263788815eb256f
|
|
| BLAKE2b-256 |
6319dac20e3cc3de171e792b87a2addea5f689e1d4392a5260893515bedc9db8
|