You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting_started/introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,7 @@ def tabs():
100
100
),
101
101
rx.tabs.content(
102
102
rx.markdown(
103
-
f"""Each page is a Python function that returns a Reflex component. You can define multiple pages and navigate between them, see the [Routing]({pages.routes.path}) section for more information.
103
+
f"""Each page is a Python function that returns a Reflex component. You can define multiple pages and navigate between them, see the [pages]({pages.overview.path}) section for more information.
104
104
105
105
- Start with a single page and scale to 100s of pages.
Pages map components to different URLs in your app. This section covers creating pages, handling URL arguments, accessing query parameters, managing page metadata, and handling page load events.
11
10
12
11
## Adding a Page
13
12
@@ -70,7 +69,7 @@ You can directly import the module or import another module that imports the dec
70
69
71
70
### Links
72
71
73
-
Links are accessible elements used primarily for navigation. Use the `href` prop to specify the location for the link to navigate to.
72
+
[Links]({library.typography.link.path}) are accessible elements used primarily for navigation. Use the `href` prop to specify the location for the link to navigate to.
74
73
75
74
```python demo
76
75
rx.link("Reflex Home Page.", href="https://reflex.dev/")
@@ -79,10 +78,16 @@ rx.link("Reflex Home Page.", href="https://reflex.dev/")
79
78
You can also provide local links to other pages in your project without writing the full url.
80
79
81
80
```python demo
82
-
rx.link("Example", href="/docs/library",)
81
+
rx.link("Example", href="/docs/library")
83
82
```
84
83
85
-
Check out the docs [here]({library.typography.link.path}) to learn more.
84
+
To open the link in a new tab, set the `is_external` prop to `True`.
85
+
86
+
```python demo
87
+
rx.link("Open in new tab", href="https://reflex.dev/", is_external=True)
88
+
```
89
+
90
+
Check out the [link docs]({library.typography.link.path}) to learn more.
86
91
87
92
```md video https://youtube.com/embed/ITOZkzjtjUA?start=4083&end=4423
88
93
# Video: Link-based Navigation
@@ -147,13 +152,9 @@ app = rx.App()
147
152
148
153
This component will be available at `/nested/page`.
149
154
150
-
## Getting the Current Page Link
151
-
152
-
The `router.page.path` attribute allows you to obtain the path of the current page from the router data,
153
-
for dynamic pages this will contain the slug rather than the actual value used to load the page.
155
+
## Getting the Current Page
154
156
155
-
To get the actual URL displayed in the browser, use `router.page.raw_path`. This
156
-
will contain all query parameters and dynamic path segments.
157
+
You can access the current page from the `router` attribute in any state. See the [router docs]({docs.utility_methods.router_attributes.path}) for all available attributes.
157
158
158
159
```python
159
160
classState(rx.State):
@@ -163,6 +164,13 @@ class State(rx.State):
163
164
# ... Your logic here ...
164
165
```
165
166
167
+
The `router.page.path` attribute allows you to obtain the path of the current page from the router data,
168
+
for dynamic pages this will contain the slug rather than the actual value used to load the page.
169
+
170
+
To get the actual URL displayed in the browser, use `router.page.raw_path`. This
171
+
will contain all query parameters and dynamic path segments.
172
+
173
+
166
174
In the above example, `current_page_route` will contain the route pattern (e.g., `/posts/[id]`), while `current_page_url`
167
175
will contain the actual URL (e.g., `http://example.com/posts/123`).
168
176
@@ -178,15 +186,3 @@ class State(rx.State):
178
186
```
179
187
180
188
In this example, running on `localhost` should display `http://localhost:3000/user/hey/posts/3/`
181
-
182
-
## Getting Client IP
183
-
184
-
You can use the `router.session.client_ip` attribute to obtain the IP address of the client associated
0 commit comments