r/reactjs • u/Ganapativs • Jul 25 '26
Show /r/reactjs Microcharts - 106 tiny React charts that fit inside a line of text, zero deps
Been building this on and off for a while. Most charting libs assume the chart is the main thing on the page. I wanted the small version, something you can drop inside a sentence or a table cell and read at a glance.
106 types so far, no dependencies (not even D3, the scales and path math are all in there), each one's a couple kb.
Default export is plain SVG with no JS shipped, so they work in server components as-is. Import the interactive build if you want hover and keyboard.
Every chart also builds its own text description from the data and exposes it as the accessible label, so a screen reader reads "weekly revenue, trending up 200%, range 3 to 9, last value 9" instead of just "image". No AI, just templates filled from the same numbers the chart draws, so the words can't drift from the picture.
The fiddly part was the labels drawn on the chart itself. Normally you measure the text to place it, but these render on the server too and getBBox just returns 0 there. So widths get estimated from the character count and the space reserved up front, with a test on every chart making sure nothing spills outside the viewBox.
Gallery: microcharts.dev
Code (MIT): github.com/ganapativs/microcharts
Still rough in spots. Mostly after feedback on the API and overall experience of using the library.
12
u/cjthomp Jul 25 '26
The actual product looks nice, but that landing page is annoying. Mostly the copy and the fact that everything is constantly moving out from under my eyes.
10
u/juicybot Jul 25 '26
nice, this is really neat
7
u/LancelotLac Jul 25 '26
I think a huge improvement on this idea looking at the gallery would be the addition of axis's. The graphs look good but there is no concept of values or meaning. I think if you could find a way to represent that while keeping it minimal would help with the whole point of a graph which is how do I summarize a spreadsheet.
4
u/kurtextrem Jul 25 '26
I think the idea is neat, this is pretty much like emojis in sentences to break them into visual distinct pieces, which can make reading easier! It's also positive that the post here also doesn't sound like AI (unlike lots of others in this sub), so I genuinely think this is a cool project... but man, the landing page screaaaaams "Opus build a landing page for this git repo make no mistakes", it looks like 100% slop (which is sad, because once again everything in there seems like you put thoughts into it)
3
u/AshutoshKS Jul 26 '26
Spend atleast 5% of the time on the landing page that you spent on the product. It's just too distracting, but your product is solid mate. 10/10 would use
2
u/Ganapativs Jul 25 '26
Happy to answer anything. Mostly curious where people would actually drop these - I built it for table cells and inline-in-a-sentence, but keep finding new spots.
2
u/whole_kernel Jul 25 '26
Damn! This is rad
2
u/robertovertical Jul 26 '26
Nicely done op! I will be using these. Curious if you’ve run across airbnbs similar to u. But not as robust as ur micros. https://visx.airbnb.tech/
2
u/thrae_awa Jul 25 '26
Very nice indeed!
2
u/Diogomartf Jul 30 '26
looks pretty cool!
2
u/CristianMR7 Jul 31 '26
My man! Thanks!
1
u/skatastic57 Jul 25 '26
Remindme! Monday
1
u/EarlyAge159 Jul 25 '26
Wow! That looks really nice!
1
u/chaser2099 Jul 26 '26
That’s actually super cool