The Component Workshop: Reflex's 100 Library Components
·
Course overview
Layout
·
Box
·
Flex
·
Stack
·
Grid
·
Container
·
Section
·
Center
·
Spacer
·
Separator
·
Card
·
Inset
·
Aspect Ratio
·
Fragment
Typography
·
Text
·
Heading
·
Link
·
Code
·
Markdown
·
Blockquote
·
Quote
·
Strong
·
Em
·
Kbd
Forms
·
Button
·
Input
·
Text Area
·
Checkbox
·
Switch
·
Radio Group
·
Select
·
Slider
·
Form
·
Upload
Data display
·
Badge
·
Avatar
·
Icon
·
Callout
·
List
·
Data List
·
Code Block
·
Progress
·
Spinner
·
Scroll Area
·
Moment
Disclosure
·
Tabs
·
Accordion
·
Segmented Control
Overlay
·
Tooltip
·
Popover
·
Hover Card
·
Dialog
·
Alert Dialog
·
Drawer
·
Dropdown Menu
·
Context Menu
·
Toast
Dynamic rendering
·
Cond
·
Match
·
Foreach
·
Auto Scroll
Media
·
Image
·
Audio
·
Video
Tables and data grids
·
Table
·
Data Table
·
Data Editor
Charts
·
Area Chart
·
Bar Chart
·
Line Chart
·
Composed Chart
·
Pie Chart
·
Radar Chart
·
Radial Bar Chart
·
Scatter Chart
·
Funnel Chart
·
Treemap
·
Sankey Chart
·
Error Bar
Chart parts
·
Axis
·
Cartesian Grid
·
Chart Tooltip
·
Legend
·
Label
·
Reference
·
Brush
Other chart libraries
·
Plotly
·
Pyplot
HTML elements
·
HTML
·
HTML Text
·
HTML Layout
·
HTML Forms
·
HTML Media
·
HTML Tables
·
SVG
Other tools
·
Theme
·
Skeleton
·
Clipboard
·
Html Embed
·
Script
·
Memo
Workshop order
Write the number right on top of each bar, and put the name "Pages" below the horizontal axis.
Two parts write text inside a chart. rx.recharts.label attaches one piece of text to one spot, such as an axis or a reference line; rx.recharts.label_list automatically writes a value at every data point of a series. Numbers on top of bars are label_list; axis names are label.
label_data = [
{"name": "Page A", "uv": 4000, "pv": 2400, "amt": 2400},
{"name": "Page B", "uv": 3000, "pv": 1398, "amt": 2210},
{"name": "Page C", "uv": 2000, "pv": 5800, "amt": 2290},
{"name": "Page D", "uv": 2780, "pv": 3908, "amt": 2000},
{"name": "Page E", "uv": 1890, "pv": 4800, "amt": 2181},
{"name": "Page F", "uv": 2390, "pv": 3800, "amt": 2500},
{"name": "Page G", "uv": 3490, "pv": 4300, "amt": 2100},
]
rx.recharts.bar_chart(
rx.recharts.cartesian_grid(stroke_dasharray="3 3"),
rx.recharts.bar(
rx.recharts.label_list(data_key="uv", position="top"),
data_key="uv",
fill=rx.color("accent", 8),
),
rx.recharts.x_axis(
rx.recharts.label(value="center", position="center", offset=30),
rx.recharts.label(value="inside left", position="insideLeft", offset=10),
rx.recharts.label(value="inside right", position="insideRight", offset=10),
height=50,
),
data=label_data,
margin={"left": 20, "right": 20, "top": 20, "bottom": 20},
width="100%",
height=250,
)label goes inside x_axis as a child and attaches to the axis. value is the text, position the spot, offset the distance it is pushed from that spot. label_list goes inside bar as a child and writes the value of the data_key column on each bar.
From here on the examples reuse the label_data defined above.
Try the props
list_position
list_fill
value
position
rx.recharts.bar_chart(
rx.recharts.bar(
rx.recharts.label_list(data_key="uv", position="top", fill=rx.color("gray", 11)),
data_key="uv",
fill=rx.color("accent", 6),
),
rx.recharts.x_axis(
rx.recharts.label(value="Pages", position="center"),
data_key="name",
height=50,
),
data=label_data,
margin={"top": 20, "left": 20, "right": 20},
width="100%",
height=280,
)rx.recharts.label
| Prop | Values | Default | Use |
|---|---|---|---|
value | string | - | Text to show |
position | "top" "left" "right" "bottom" "inside" "outside" "insideLeft" "insideRight" "insideTop" "insideBottom" "insideTopLeft" "insideBottomLeft" "insideTopRight" "insideBottomRight" "insideStart" "insideEnd" "end" "center" | - | Spot within the parent area |
offset | number | - | Distance pushed from that spot |
view_box | dict | automatic | Reference area. Usually calculated automatically |
rx.recharts.label_list
| Prop | Values | Default | Use |
|---|---|---|---|
data_key | column name | - | Column whose value is written at each point |
position | the same 18 values as label | - | Spot relative to the bar or point |
offset | number | 5 | Distance from that spot |
fill | color | rx.color("gray", 10) | Text color |
stroke | color | "none" | Text outline color |
label_list writes text at every data point of the series that contains it. With two bars, put one label_list in each bar and choose with data_key which column's value to write.
rx.recharts.bar_chart(
rx.recharts.bar(
rx.recharts.label_list(data_key="uv", position="top"),
data_key="uv",
stroke="#8884d8",
fill="#8884d8",
),
rx.recharts.bar(
rx.recharts.label_list(data_key="pv", position="top"),
data_key="pv",
stroke="#82ca9d",
fill="#82ca9d",
),
rx.recharts.x_axis(data_key="name"),
rx.recharts.y_axis(),
margin={"left": 10, "right": 0, "top": 20, "bottom": 10},
data=label_data,
width="100%",
height=300,
)Styling that label has no prop for goes straight to Recharts through custom_attrs. Set the font size and weight, and turn the vertical axis name upright along the axis by setting angle to 270.
rx.recharts.area_chart(
rx.recharts.area(data_key="uv", stroke=rx.color("accent", 9), fill=rx.color("accent", 8)),
rx.recharts.x_axis(
rx.recharts.label(value="Pages", position="center", custom_attrs={"fontSize": "12px", "fontWeight": "700"}),
data_key="name",
height=60,
),
rx.recharts.y_axis(
rx.recharts.label(value="Views", position="left", custom_attrs={"angle": 270, "fontSize": "12px", "fontWeight": "700"}),
),
data=label_data,
margin={"left": 20, "right": 20, "top": 25},
width="100%",
height=300,
)Besides axes, label can be a child of reference_line, reference_dot and reference_area. Use it to put "Goal" on a target line or a name on a highlighted range. The text color is also set with fill in custom_attrs.
rx.recharts.line_chart(
rx.recharts.line(data_key="pv", stroke=rx.color("accent", 9)),
rx.recharts.reference_line(
rx.recharts.label(value="Goal 5000", position="insideTopRight", custom_attrs={"fill": rx.color("red", 11)}),
y=5000,
stroke=rx.color("red", 9),
stroke_dasharray="4 4",
),
rx.recharts.reference_area(
rx.recharts.label(value="Campaign", position="insideTop"),
x1="Page C",
x2="Page E",
fill=rx.color("amber", 5),
fill_opacity=0.4,
),
rx.recharts.x_axis(data_key="name"),
rx.recharts.y_axis(),
data=label_data,
width="100%",
height=280,
)Add two label_lists: the value on top of each bar and the page name inside the bottom of the bar. Since the names are on the bars, turn off the axis ticks and keep only "Pages" below the axis with a label.
rx.recharts.bar_chart(
rx.recharts.bar(
rx.recharts.label_list(data_key="uv", position="top", fill=rx.color("gray", 11)),
rx.recharts.label_list(data_key="name", position="insideBottom", fill="white", offset=10),
data_key="uv",
fill=rx.color("accent", 9),
radius=[4, 4, 0, 0],
),
rx.recharts.x_axis(
rx.recharts.label(value="Pages", position="insideBottom", custom_attrs={"fontWeight": "700"}),
tick=False,
height=30,
),
data=label_data,
margin={"top": 20},
width="100%",
height=280,
)Workshop notes
label is one piece of text at one spot; label_list is one value at every data point.
label is a child of x_axis, y_axis or reference_*; label_list is a child of a series such as bar, line or area.
value, position and offset set the text and its spot. position has 18 values.
Styling without a prop (fontSize, fontWeight, angle) goes through custom_attrs.
Get news about new lessons
We'll email you when this course gets new lessons or a follow-up course opens.
R
ReflexKR
Learn Python and Reflex by doing. Every example was run and verified on Reflex 0.10.0.
ReflexKR is free, with no banner ads. If it helped you, you can support it with a coffee. ☕ Buy us a coffee
Affiliate disclosure© 2026 ReflexKR · Since 2026 · CC BY-NC 4.0
Questions & answers
Ask anything about this lesson. Questions from every language version of this page appear together.