Skip to content

Commit 6f14ca7

Browse files
committed
and now for something completely different
1 parent 7fc038c commit 6f14ca7

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

plugins/ui/docs/components/router.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ app = app()
107107

108108
This produces the following route table:
109109

110-
| URL Path | Matched Element | Params |
111-
| ---------------- | --------------- | ------------------------ |
112-
| `/` | `dashboard` | `{}` |
113-
| `/users` | `user_page` | `{}` |
114-
| `/users/42` | `user_page` | `{"user_id": "42"}` |
115-
| `/anything-else` | `not_found` | `{"*": "anything-else"}` |
110+
| URL Path | Matched Element | Params |
111+
| ---------------- | --------------- | ------------------------- |
112+
| `/` | `dashboard` | none |
113+
| `/users` | `user_page` | none |
114+
| `/users/42` | `user_page` | `"user_id"` = `"42"` |
115+
| `/anything-else` | `not_found` | `"*"` = `"anything-else"` |
116116

117117
## Recommendations
118118

@@ -146,11 +146,17 @@ This produces the following route table:
146146

147147
#### Path patterns
148148

149-
- `{var_name}`: Required dynamic segment
150-
- `{var_name?}`: Optional dynamic segment (matches zero or one segments)
151-
- `*`: Wildcard, matches any remaining path segments
152-
- Static text: Exact match
149+
```python skip-test
150+
{var_name} # Required dynamic segment
151+
{var_name?} # Optional dynamic segment (matches zero or one segments)
152+
* # Wildcard, matches any remaining path segments
153+
segment # Static text: Exact match
154+
```
153155

154156
See [`use_params`](../hooks/use_params.md) for more details on route parameters.
155157

156-
Child paths are appended to parent paths. For example, `ui.route(ui.route(path="{user_id}"), path="users")` produces `/users/{user_id}`.
158+
Child paths are appended to parent paths. For example:
159+
160+
```python skip-test
161+
ui.route(ui.route(path="{user_id}"), path="users") # produces /users/{user_id}
162+
```

plugins/ui/docs/hooks/use_params.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ app = app()
104104

105105
## Route Parameter Patterns
106106

107-
Route parameters are defined by <code>{"{var_name}"}</code> segments in route paths:
107+
Route parameters are defined by segments in the route path that are enclosed in curly braces. The following patterns are supported:
108108

109-
- `{user_id}` matches a required segment and extracts it as `"user_id"` in the params dict.
110-
- `{tab?}` matches an optional segment. The parameter is not included if the segment is missing.
111-
- `*` matches any remaining path. The value is available as the `"*"` key.
109+
```python skip-test
110+
{var_name} # matches a required segment and extracts it as "var_name" in the params dict
111+
{tab?} # matches an optional segment; the parameter is omitted if the segment is missing
112+
* # matches any remaining path; the value is available as the "*" key
113+
```
112114

113115
See [`router`](../components/router.md) for more details on defining routes and path patterns.
114116

0 commit comments

Comments
 (0)