Skip to content

Commit bea2f37

Browse files
Alek99claude
andcommitted
Refine Getting Started docs: typography, preview styling, content polish
Port reflex-web PR #1818 plus content polish across all Getting Started pages. Typography & preview styling (docs/app + packages/reflex-ui-shared): - Tighter headings (smaller, semibold) and lighter body weight - Wider content column (42rem→52rem / 56rem→64rem); right sidebar moved from xl: to 2xl: so mid-width screens have more room - Navbar tabs visible from md: (was xl:) so they don't collapse to a burger at medium widths - Pill-style tabs (pill-tab / pill-tab-list); slate-tinted inline rt-Code; hover-reveal copy button with "Copy" label; softer borders - docgen_pipeline: cleaner rx.el.div section/tabs renderers with consistent gap and padding Getting Started content: - Introduction: new tagline, pill tabs, slate highlight (was violet), tightened walkthrough, added "Keep learning" / "Ship faster with AI" CTA cards - Installation: added ~3 min estimate, removed embedded video, rewrote as a single uv-based flow with <your-app> placeholder, promoted Rosetta + bun.exe notes to md alert blocks, added "Next" CTA - Basics: added ~10 min estimate, flattened Prerequisites wrapper, consolidated four single-line setup steps, fixed `rx.app` typo, fixed three broken [`code`](link) markdown links (rx.el / rx.cond / rx.foreach were rendering empty), added two CTA cards - Dashboard tutorial: added ~20 min estimate, trimmed ~180-line finished-app dump at top down to a one-sentence roadmap + link to #full-app, numbered Setup steps, promoted "What are you building?" from H3 to H2, renamed Conclusion → Full app + Recap, dropped Advanced Section stub, unified all 10 preview boxes (slate border, 12px radius, 2em padding, spacing="4", rx.box wrap) Sidebar order: - Getting Started now lists Installation before Introduction Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ffecc27 commit bea2f37

11 files changed

Lines changed: 415 additions & 520 deletions

File tree

β€Ždocs/app/assets/tailwind-theme.cssβ€Ž

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,14 @@
16991699
/* padding: 0rem 0.125rem 0rem 0.125rem; */
17001700
}
17011701

1702+
/* Override Radix Code (rt-Code) accent coloring so inline code matches slate theme */
1703+
code.rt-Code,
1704+
code.rt-Code.rt-variant-soft,
1705+
.rt-Code.rt-variant-soft {
1706+
color: var(--c-slate-11) !important;
1707+
background-color: var(--c-slate-3) !important;
1708+
}
1709+
17021710
.code-error-style {
17031711
font-family: var(--font-jetbrains);
17041712
font-size: 0.835rem;
@@ -1803,6 +1811,44 @@
18031811
}
18041812
}
18051813

1814+
.code-block button,
1815+
.code-block > button {
1816+
border: none !important;
1817+
border-width: 0 !important;
1818+
background: transparent !important;
1819+
background-color: transparent !important;
1820+
opacity: 0 !important;
1821+
transition: opacity 0.15s ease-out !important;
1822+
pointer-events: none;
1823+
display: inline-flex !important;
1824+
align-items: center !important;
1825+
gap: 0.375rem !important;
1826+
font-size: 0.8125rem !important;
1827+
font-weight: 500 !important;
1828+
color: var(--c-slate-11) !important;
1829+
top: 8px !important;
1830+
right: 12px !important;
1831+
padding: 6px 8px !important;
1832+
}
1833+
1834+
.code-block button::after,
1835+
.code-block > button::after {
1836+
content: "Copy";
1837+
}
1838+
1839+
.code-block:hover button,
1840+
.code-block:hover > button,
1841+
.code-block button:focus-visible {
1842+
opacity: 1 !important;
1843+
pointer-events: auto;
1844+
}
1845+
1846+
.code-block button:hover,
1847+
.code-block > button:hover {
1848+
background: var(--c-slate-3) !important;
1849+
background-color: var(--c-slate-3) !important;
1850+
}
1851+
18061852

18071853
.tab-style {
18081854
color: var(--c-slate-9);
@@ -1814,6 +1860,89 @@
18141860
letter-spacing: -0.01094rem;
18151861
}
18161862

1863+
.pill-tab-list {
1864+
display: inline-flex !important;
1865+
gap: 2px !important;
1866+
padding: 4px !important;
1867+
background: var(--c-slate-3) !important;
1868+
border-radius: 10px !important;
1869+
border-bottom: none !important;
1870+
box-shadow: none !important;
1871+
width: fit-content !important;
1872+
max-width: 100%;
1873+
overflow-x: auto;
1874+
}
1875+
1876+
.pill-tab-list::before,
1877+
.pill-tab-list::after {
1878+
display: none !important;
1879+
content: none !important;
1880+
}
1881+
1882+
.pill-tab {
1883+
appearance: none !important;
1884+
background: transparent !important;
1885+
background-color: transparent !important;
1886+
border: none !important;
1887+
padding: 8px 16px !important;
1888+
font-size: 0.9375rem !important;
1889+
font-weight: 450 !important;
1890+
color: var(--c-slate-11) !important;
1891+
border-radius: 7px !important;
1892+
cursor: pointer;
1893+
white-space: nowrap;
1894+
transition: color 0.12s, background-color 0.12s, box-shadow 0.12s;
1895+
letter-spacing: 0 !important;
1896+
line-height: 1.25rem !important;
1897+
box-shadow: none !important;
1898+
}
1899+
1900+
.pill-tab::before,
1901+
.pill-tab::after,
1902+
.pill-tab:hover::before,
1903+
.pill-tab:hover::after,
1904+
.pill-tab[data-state='active']::before,
1905+
.pill-tab[data-state='active']::after,
1906+
.pill-tab[data-state='active']:hover::before,
1907+
.pill-tab[data-state='active']:hover::after {
1908+
background: transparent !important;
1909+
background-color: transparent !important;
1910+
box-shadow: none !important;
1911+
content: none !important;
1912+
display: none !important;
1913+
}
1914+
1915+
.pill-tab:hover {
1916+
color: var(--c-slate-11) !important;
1917+
background: transparent !important;
1918+
}
1919+
1920+
.pill-tab .rt-BaseTabListTriggerInner,
1921+
.pill-tab:hover .rt-BaseTabListTriggerInner,
1922+
.pill-tab:focus-visible .rt-BaseTabListTriggerInner,
1923+
.pill-tab:focus-visible:hover .rt-BaseTabListTriggerInner {
1924+
background-color: transparent !important;
1925+
background: transparent !important;
1926+
}
1927+
1928+
.pill-tab[data-state='active'],
1929+
.pill-tab[data-state='active']:hover {
1930+
color: var(--c-slate-12) !important;
1931+
font-weight: 500 !important;
1932+
background: var(--c-slate-1) !important;
1933+
background-color: var(--c-slate-1) !important;
1934+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
1935+
}
1936+
1937+
:where(.dark, .dark *) .pill-tab[data-state='active'] {
1938+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
1939+
}
1940+
1941+
.tab-style:hover:not([data-state='active'])::before {
1942+
background: transparent !important;
1943+
background-color: transparent !important;
1944+
}
1945+
18171946
.tab-style:hover {
18181947
color: var(--c-slate-11);
18191948
}

β€Ždocs/app/reflex_docs/docgen_pipeline.pyβ€Ž

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,19 @@ def _render_tabs(self, block: DirectiveBlock) -> rx.Component:
666666
rx.tabs.trigger(
667667
title,
668668
value=value,
669-
class_name="tab-style font-base font-semibold text-[1.25rem]",
669+
class_name="pill-tab",
670670
)
671671
)
672672
contents.append(
673-
rx.tabs.content(self._render_children(body_blocks), value=value),
673+
rx.tabs.content(
674+
self._render_children(body_blocks),
675+
value=value,
676+
class_name="pt-6",
677+
),
674678
)
675679

676680
return rx.tabs.root(
677-
rx.tabs.list(*triggers, class_name="mt-4"),
681+
rx.tabs.list(*triggers, class_name="pill-tab-list mt-2"),
678682
*contents,
679683
default_value="tab1",
680684
)
@@ -702,29 +706,43 @@ def _render_definition(self, block: DirectiveBlock) -> rx.Component:
702706

703707
def _render_section(self, block: DirectiveBlock) -> rx.Component:
704708
"""Render a ``md section`` directive."""
705-
from reflex_ui_shared.styles.colors import c_color
706-
707709
sections = self._split_children_by_heading(block.children)
708-
return rx.box(
709-
rx.vstack(
710+
return rx.el.div(
711+
rx.el.div(
710712
*[
711-
rx.fragment(
712-
rx.text(
713-
rx.text.span(header, font_weight="bold"),
714-
width="100%",
713+
rx.el.div(
714+
rx.el.div(
715+
header,
716+
style={
717+
"fontWeight": "600",
718+
"color": "var(--c-slate-12)",
719+
"fontSize": "1rem",
720+
"lineHeight": "1.5",
721+
},
715722
),
716-
rx.box(self._render_children(body), width="100%"),
723+
rx.el.div(
724+
self._render_children(body),
725+
style={"width": "100%"},
726+
),
727+
style={
728+
"display": "flex",
729+
"flexDirection": "column",
730+
"gap": "0.25rem",
731+
"width": "100%",
732+
},
717733
)
718734
for header, body in sections
719735
],
720-
text_align="left",
721-
margin_y="1em",
722-
width="100%",
736+
style={
737+
"display": "flex",
738+
"flexDirection": "column",
739+
"gap": "1.25rem",
740+
"width": "100%",
741+
"paddingLeft": "1.5rem",
742+
"borderLeft": "1.5px solid var(--c-slate-4)",
743+
},
723744
),
724-
border_left=f"1.5px {c_color('slate', 4)} solid",
725-
padding_left="1em",
726-
width="100%",
727-
align_items="center",
745+
style={"width": "100%", "margin": "1.5rem 0"},
728746
)
729747

730748

β€Ždocs/app/reflex_docs/templates/docpage/docpage.pyβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ def wrapper(*args, **kwargs) -> rx.Component:
531531
class_name="lg:mt-0 h-auto",
532532
),
533533
class_name=ui.cn(
534-
"flex-1 h-auto mx-auto lg:max-w-[42rem] px-4 overflow-y-auto",
535-
"lg:max-w-[56rem]" if not show_right_sidebar else "",
534+
"flex-1 h-auto mx-auto lg:max-w-[52rem] px-4 overflow-y-auto",
535+
"lg:max-w-[64rem]" if not show_right_sidebar else "",
536536
),
537537
),
538538
rx.box(
@@ -611,7 +611,7 @@ def wrapper(*args, **kwargs) -> rx.Component:
611611
),
612612
),
613613
class_name=(
614-
"w-[240px] h-screen sticky top-0 shrink-0 hidden xl:block"
614+
"w-[240px] h-screen sticky top-0 shrink-0 hidden 2xl:block"
615615
),
616616
)
617617
if show_right_sidebar and not pseudo_right_bar

β€Ždocs/app/reflex_docs/templates/docpage/sidebar/sidebar_items/learn.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def get_sidebar_items_learn():
1010
create_item(
1111
"Getting Started",
1212
children=[
13-
getting_started.introduction,
1413
getting_started.installation,
14+
getting_started.introduction,
1515
getting_started.basics,
1616
getting_started.project_structure,
1717
getting_started.dashboard_tutorial,

β€Ždocs/app/reflex_docs/views/docs_navbar.pyβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def menu_item(text: str, href: str, active_str: str = "") -> rx.Component:
7070
to=href,
7171
),
7272
class_name=ui.cn(
73-
"xl:flex hidden h-full items-center justify-center",
73+
"md:flex hidden h-full items-center justify-center",
7474
rx.cond(active, active_cn, ""),
7575
),
7676
custom_attrs={"role": "menuitem"},
@@ -111,7 +111,7 @@ def navigation_menu() -> rx.Component:
111111
),
112112
ui.navigation_menu.item(
113113
navbar_sidebar_button(),
114-
class_name="xl:hidden flex",
114+
class_name="md:hidden flex",
115115
unstyled=True,
116116
custom_attrs={"role": "menuitem"},
117117
),

β€Ždocs/getting_started/basics.mdβ€Ž

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import reflex as rx
33
```
44

5-
# Reflex Basics
5+
# Basics
66

7-
This page gives an introduction to the most common concepts that you will use to build Reflex apps.
7+
**~10 min** Β· An introduction to the most common concepts you'll use to build Reflex apps.
88

99
```md section
1010
# You will learn how to:
@@ -18,13 +18,7 @@ This page gives an introduction to the most common concepts that you will use to
1818
- Create pages and navigate between them
1919
```
2020

21-
[Install](/docs/getting_started/installation) `reflex` with uv before continuing.
22-
23-
```bash
24-
uv add reflex
25-
```
26-
27-
Import the `reflex` library to get started.
21+
If you haven't yet, [install Reflex](/docs/getting_started/installation) before continuing. Every example below imports the library as `rx`:
2822

2923
```python
3024
import reflex as rx
@@ -46,15 +40,15 @@ Components can be nested inside each other to create complex UIs.
4640
To nest components as children, pass them as positional arguments to the parent component. In the example below, the `rx.text` and `my_button` components are children of the `rx.box` component.
4741

4842
```python demo exec
49-
def my_page():
43+
def my_container():
5044
return rx.box(
5145
rx.text("This is a page"),
5246
# Reference components defined in other functions.
5347
my_button(),
5448
)
5549
```
5650

57-
You can also use any base HTML element through the [`rx.el`](/docs/library/other/html) namespace. This allows you to use standard HTML elements directly in your Reflex app when you need more control or when a specific component isn't available in the Reflex component library.
51+
You can also use any base HTML element through the [rx.el](/docs/library/other/html) namespace. This allows you to use standard HTML elements directly in your Reflex app when you need more control or when a specific component isn't available in the Reflex component library.
5852

5953
```python demo exec
6054
def my_div():
@@ -142,7 +136,7 @@ Vars can be referenced in multiple components, and will automatically update whe
142136
So far, we've defined state vars but we haven't shown how to change them. All state changes are handled through functions in the state class, called [event handlers](/docs/events/events_overview).
143137

144138
```md alert
145-
Event handlers are the ONLY way to change state in Reflex.
139+
Event handlers are the **only** way to change state in Reflex.
146140
```
147141

148142
Components have special props, such as `on_click`, called event triggers that can be used to make components interactive. Event triggers connect components to event handlers, which update the state.
@@ -214,7 +208,7 @@ def text_input():
214208
Make sure that the event handler has the same number of arguments as the event trigger, or an error will be raised.
215209
```
216210

217-
## Compile-time vs. runtime (IMPORTANT)
211+
## Compile-time vs. runtime
218212

219213
Before we dive deeper into state, it's important to understand the difference between compile-time and runtime in Reflex.
220214

@@ -314,7 +308,7 @@ In the next sections, we will show how to handle these cases.
314308

315309
## Conditional rendering
316310

317-
As mentioned above, you cannot use Python `if/else` statements with state vars in components. Instead, use the [`rx.cond`](/docs/components/conditional_rendering) function to conditionally render components.
311+
As mentioned above, you cannot use Python `if/else` statements with state vars in components. Instead, use the [rx.cond](/docs/components/conditional_rendering) function to conditionally render components.
318312

319313
```python demo exec
320314
class LoginState(rx.State):
@@ -338,7 +332,7 @@ def show_login():
338332

339333
## Rendering lists
340334

341-
To iterate over a var that is a list, use the [`rx.foreach`](/docs/components/rendering_iterables) function to render a list of components.
335+
To iterate over a var that is a list, use the [rx.foreach](/docs/components/rendering_iterables) function to render a list of components.
342336

343337
Pass the list var and a function that returns a component as arguments to `rx.foreach`.
344338

@@ -398,13 +392,26 @@ def index():
398392
return rx.text("Root Page")
399393

400394

401-
rx.app = rx.App()
395+
app = rx.App()
402396
app.add_page(index, route="/")
403397
```
404398

405399
## Next Steps
406400

407-
Now that you have a basic understanding of how Reflex works, the next step is to start coding your own apps. Try one of the following tutorials:
401+
You've got the core pieces β€” components, state, events, compile-time vs. runtime. Time to build.
402+
403+
```md alert info
404+
# Build something real β†’
405+
406+
- [Dashboard tutorial](/docs/getting_started/dashboard_tutorial) β€” a data app with tables, forms, and state.
407+
- [Chatapp tutorial](/docs/getting_started/chatapp_tutorial) β€” streaming AI responses end-to-end.
408+
- [Open-source templates](/docs/getting_started/open_source_templates) β€” full apps to fork.
409+
```
408410

409-
- [Dashboard Tutorial](/docs/getting_started/dashboard_tutorial)
410-
- [Chatapp Tutorial](/docs/getting_started/chatapp_tutorial)
411+
```md alert info
412+
# Go deeper β†’
413+
414+
- [Vars](/docs/vars/base_vars) and [var operations](/docs/vars/var-operations) β€” the full API.
415+
- [Events](/docs/events/events_overview) and [pages](/docs/pages/overview) β€” routing, triggers, handlers.
416+
- [How Reflex works](/docs/advanced_onboarding/how-reflex-works) β€” what runs where, and why.
417+
```

0 commit comments

Comments
Β (0)