AF

Advanced Features

A tour of rc features beyond the basics


Accordion Example
What is Accordion?
What is Accordion?

The Accordion component lets you hide long content behind labelled panels. Each block's label becomes the panel heading.

rc.Accordion(
    blocks=[rc.Markdown("...", label="Panel 1")],
    label="Section heading",
)
When to use Accordion
When to use Accordion

Use Accordion when you have several optional sections that readers may not all need — e.g. methodology notes, raw data summaries, or per-region breakdowns inside a summary report.




Show underlying SQL query
access_logs query

SELECT
    date_trunc('day', timestamp) AS day,
    status,
    COUNT(*) AS requests,
    SUM(bytes) AS total_bytes
FROM access_logs
WHERE timestamp >= CURRENT_DATE - INTERVAL '30 days'
GROUP BY 1, 2
ORDER BY 1 DESC;




EventMetric — Request Frequency Over Time


rc.EventMetric counts events matching an optional filter condition, grouped by a time frequency. The result is a spark-line style chart showing volume over time. Frequency strings follow Pandas offset aliases ('D' = daily, 'B' = business days, 'W' = weekly).

Log File Event Metrics — Business Day Frequency

Successful Requests (200):

2717

Not Found (404):

208

Server Errors (5xx):

6





Radar Chart — Multi-Series Comparison


rc.Radar takes a DataFrame where rows are series and columns are axes. Use lock_minimum_to_zero=True to anchor the scale at zero. filled=False draws outlines only.





Select — Tabs with Mixed Content


Team Results

Raw Data
Name Role Score
Alice ML Engineer 94
Bob Data Scientist 87
Carmen DevOps 91
David Analyst 78
Eve Researcher 96
Score Metrics

Alice:

94

Bob:

87

Carmen:

91

David:

78

Eve:

96

ML Pipeline
graph TD
                        A[Data Collection] --> B[Feature Engineering]
                        B --> C[Model Training]
                        C --> D{Validation}
                        D -->|Pass| E[Deployment]
                        D -->|Fail| B
pan (mouse drag) and zoom (shift + mouse wheel) (reset)




Widget — Embed Any _repr_html_() Object


rc.Widget wraps any Python object that implements _repr_html_(), including Matplotlib figures, Plotly figures, Folium maps, and Altair charts.

Plotly Express Figure




Unformatted — Preformatted Text


Server Dashboard (ASCII)
SYSTEM STATUS REPORT
  =====================
  CPU:    ████████░░  82%
  Memory: █████░░░░░  48%
  Disk:   ███░░░░░░░  31%
  Net:    ██░░░░░░░░  19%

  All systems operational.




Image — Embedded with Clickable Link


Pass convert_to_base64=True to embed remote images inline (no CORS issues, works offline). Add link_to to make the image a clickable hyperlink.

Portrait of a Man with a Medal (1475) — click to view
Portrait of a Man with a Medal (1475) — click to view
The Spring, Flora (late 1470s or early 1480s)
The Spring, Flora (late 1470s or early 1480s)