docs: redesign API Reference (interactive demo + props table polish)#6387
docs: redesign API Reference (interactive demo + props table polish)#6387
Conversation
…e polish)
- Lay out the per-component live demo and Python source side-by-side,
with syntax highlighting and live-bound prop values driven by the
same state vars as the demo (preview source string is parsed so the
code reflects what's actually rendered, including child components).
- Replace the dropdown / checkbox controls with a compact pill-button
panel scoped to styling props (variant, size, color_scheme, radius,
high_contrast, loading, disabled). Skip the demo + controls when no
styling props apply to the component.
- Rework the props table:
- Columns: prop | type | default | description (descriptions inline,
no longer hidden behind a hover icon).
- Literal types render as individual chips that wrap; long unions
no longer truncate to "...".
- Long rows clamp to ~4 lines with a fade-out mask across all four
cells and a centered "Show more / Show less" toggle row beneath
them; the row's bottom border is suppressed so the toggle reads
as part of the same logical row.
- Sidebar / popover dark-mode polish: align the left-sidebar
background with the code-block bg, swap the active highlight to
slate-3, drop the violet active-text in favor of slate-12, tone
down the "Build with AI" violet badge and gradient.
- Drop "Copy to markdown" and "Ask AI about this page" from the
right-hand TOC sidebar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR redesigns the per-component API Reference block: replaces the old select/checkbox controls with pill buttons, adds a live demo + code panel side-by-side, inlines prop descriptions into the table, adds per-row Show more / Show less toggles, and polishes dark-mode styling in the sidebar and AI dropdown.
Confidence Score: 3/5Mostly safe to merge; one P1 UX defect where the controls panel can render without a visible demo component The P1 finding (controls without live preview) is a real UX bug that can surface today whenever component.create() fails for an interactive component. It won't crash, but presents a broken UI. Capped at 3 due to the P1 in a central docs page path. docs/app/reflex_docs/pages/docs/component.py — the controls_panel visibility guard at line 756 needs to mirror the interactive_component guard. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[generate_props called] --> B{is_interactive?}
B -- No --> C[skip controls loop]
B -- Yes --> D[Loop styling_props → render_select]
D --> E[interactive_controls list populated\nprop_dict filled with state vars]
E --> F{component in previews?}
F -- Yes --> G[eval preview lambda with prop_dict]
F -- No --> H[component.create with prop_dict]
G & H --> I{comp is Fragment?}
I -- No + controls exist --> J[Build live demo + code panel\ninteractive_component]
I -- Yes --> K[interactive_component = rx.fragment]
J --> L{interactive_controls non-empty?}
K --> L
L -- Yes --> M[controls_panel shown\n⚠ visible even if comp is Fragment]
L -- No --> N[controls_panel = rx.fragment]
M & N --> O[Build props table rows\nwith Show more/less toggles]
O --> P[rx.vstack: demo · controls · Props heading · table]
Reviews (1): Last reviewed commit: "docs: redesign API Reference (interactiv..." | Re-trigger Greptile |
3ac4616 to
41c9b4f
Compare
- Wire up the existing High Level / Low Level toggle on component pages: fix the LL existence check to use the absolute actual_path (was a relative path that didn't resolve from the dev-server cwd), and route the LL `out` handler through the same absolute path. - Register `-ll.md` files in `doc_markdown_sources` so they're served as static assets at `/<path>-ll.md`. Update the right-rail copy button to fetch from the right URL on `/low` pages and reject responses whose content-type isn't markdown (which would have copied the SPA shell HTML instead of the doc). - Color type chips in the props table via `color_scheme` + `variant= soft` instead of the inline `style=` dict, which radix's `<Code>` was stripping (chips were showing only the outline, no fill). - Add a `Tutorials` accordion in the Onboarding sidebar that pulls the Dashboard and Chat App tutorials out of `Getting Started`. Map it to a `graduation-cap` icon in `sidebar_icon`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41c9b4f to
6abe5a3
Compare
The Fields/Methods tables on /docs/api-reference/<class>/ pages were wrapped in `rx.scroll_area(max_height="35em")`, which capped each table at ~560px and made it scroll internally. Render the full table inline instead so the page just gets longer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… template - "How to Host" card on the docs landing page is now labeled "Deployment". - Right-rail "Raise an issue" link previously pointed at the archived `reflex-dev/reflex-web` repo and used `&` in the URL, which sent the literal `amp;body=...` to GitHub. Repoint at `reflex-dev/reflex`, fix the entity, prefill title/body with the current page path, pre-select the new "Documentation" issue template tab, and pre-add the `documentation` label. - "Edit this page" link likewise pointed at `reflex-web/tree/main` and produced `…/<path>/.md` (extra slash, missing `docs/` prefix). Use `reflex/blob/main/docs<path>.md` so the link lands on the actual markdown file. - Add `.github/ISSUE_TEMPLATE/documentation.md` so the `?template=documentation.md` URL resolves. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…eaders - Replace hardcoded #1a1b1d sidebar bg with dark:before:bg-secondary-2. - Switch _PILL_BTN_CLASS to text-sm font-medium and the secondary-* palette. - Use border-secondary-* / bg-secondary-* for the controls panel and props table header / chrome. - Merge prop-table column header classes via ui.cn(...) instead of string concatenation. - Pack the color_scheme popover into a fixed grid-cols-[repeat(6,2rem)] swatch grid so the rows align evenly; give inactive swatches a transparent border so the active selection doesn't shift the layout. - Uppercase the props table headers (prop / type / default / description). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>






























Summary
Redesigns the per-component API Reference block in the docs site:
rx.icon,placeholder=...show up correctly), and is bound to the same state vars as the demo — selectingvariant=surfaceupdates both the rendered button andvariant=\"surface\"in the code. Manual syntax highlighting (function call / string / bool tokens) is applied via colored spans.variant,size,color_scheme,radius,high_contrast,loading,disabled). Components with no styling props skip the demo + controls and go straight to the props table.prop | type | default | descriptionwith descriptions inline (no more info-icon hover). Literal types render as individual chips that wrap to multiple lines. Long rows clamp to ~4 lines with a fade-out mask across all four columns and a centeredShow more / Show lesstoggle row beneath; the data row's bottom border is suppressed so the toggle reads as part of the same logical row.slate-3, active text usesslate-12(was violet), the "Build with AI" violet badge + gradient toned down for dark mode.Test plan
/docs/library/forms/button/: verify the demo + code render side-by-side, pill controls update both, prop table descriptions are inline, type chips wrap./docs/library/forms/input/and scroll torx.input.slot: code panel reflects the actual preview structure (icon child + placeholder), not just(...).Button) and clickShow moreon therole/color_schemerows.rx.upload): confirm no demo + controls panel appears.🤖 Generated with Claude Code