shadcn.io is not affiliated with official shadcn/ui
Log Frequency Table Stats Block for React
A log-analytics table of five severity levels with the count, the lines a minute, and a bar whose length is the logarithm of the count, plus a filter that dims the quieter levels.
Installation
Overview
A log-frequency table for React with Base UI. Loglume, a log analytics product, puts five severities in a real table: the level in mono, the total, how many lines a minute, and that level's share of the stream beside a bar. The bar's length is the logarithm of the count, so a rare level still has a visible length and the busiest level fills it. A ToggleGroup (All, Warnings and up, Errors) dims every row below the chosen rank and leaves the row mounted, so the table does not jump. The headline, the totals, the rates, the shares and the bars all come from one list of counts. The block is Guides, ToggleGroup and a table. For the numbers section of a logging, observability or platform page.
FAQ
How do I change the levels?
Edit LEVELS and MINUTES at the top of the file. Each level is a code, a count and a rank (ERROR is the loudest). The total, the lines a minute, the share of the stream, the bar and the headline are all read from that list. The window is two hours because MINUTES is 120, and the copy uses that number, so it never goes stale.
Why is the bar a different length from the percent?
They measure different things, and the caption says so. The percent is the level's share of every line in the window. The bar is the logarithm of the count, scaled so the busiest level fills it. On a linear bar, INFO would fill the row and ERROR would be a sliver; the log length keeps the rare levels readable. The busiest level is worked out from the counts, so the headline and the full bar always name the same level.
What does the filter do?
All leaves every row bright. Warnings and up keeps ERROR and WARN bright and dims INFO, DEBUG and TRACE. Errors keeps only ERROR bright. A dimmed row is still there: its text goes quiet and its bar lightens, and a polite line under the control says which levels stayed bright. That line sits over unseen copies of the other two, so its height never changes. Nothing is removed, so the table keeps its height.
Why not hide the quiet rows?
Hiding them would collapse the table and move the page. Dimming leaves the counts readable for anyone who still wants them, and the contrast stays in the text colour rather than fading the row out. The rank check is rank against the filter's floor, so a new level slots in by the rank you give it.
Is the table accessible?
Yes. It is a real table with a caption and column headers. Each level is a row header. Values sit in bdi elements. The bars are decorative, because the percent next to them says the share and the caption says the bar is a logarithm. The filter is a ToggleGroup with an accessible name, and the line under it is a polite live region, so a change of filter is announced and a quiet row is not removed from the reading order.
What happens on a phone?
The per-minute column hides, and the level, the total and the frequency stay. The filter sits under the header on one line and scrolls if the labels need more room than the screen, so a label is never cut off. The header fades in once; the table does not, because on a short screen it can start below the fold.
Related
- Pro
Log Scale Histogram Stats
DistributionsA payload-size histogram on a log axis with gridlines at 1, 10, 100, 1K and 10K, ten buckets that double in size, a note that each line is ten times the one below, and p50, p90 and p99 badges tagged on their columns.
- Pro
Revenue Funnel Stats
FunnelsA funnel as a real table for a sales team's pipeline: stage, deals, step conversion and value, each number with a thin bar to the scale of its column, and the overall conversion rolling in the header.
- Pro
Grouped Bar Chart Stats
Bar and columnTwo bars per month, this year solid and last year lighter, with a Chart and Table switch that swaps the drawing for a real table of the same numbers in the same box.
- Pro
Cohort Retention Table Stats
HeatmapsA triangular retention table of six weekly signup cohorts by months M0 to M5, a percent in every cell in five foreground steps, an average row at the foot and the month-one average in the header.
- Pro
Count Buckets Histogram Stats
DistributionsAn order-value histogram of eight $25 buckets with the count above each column, the most common bucket drawn solid, the median bucket underlined and three figures above the chart: orders, the median bucket and the busiest bucket's share.
- Pro
Horizontal Bar Chart Card Stats
Bar and columnNine ranked survey answers where each row is its own bar: a quiet fill from the start behind the label, the share and the count at the end, and the leading row a little stronger.