BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/scificn/line-chart

Line Chart

scificn/line-chart
FreeComponent

SVG line chart with multi-series support, animated draw-on, area fill, grid lines, and legend.

Live preview

live · rendered by the registry
Rendered by scificn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.scificn.dev/r/line-chart.json

Source

ui/line-chart/line-chart.tsxwww.scificn.dev/r/line-chart.json · first 6 KB
1'use client'
2
3import * as React from 'react'
4import { cn } from '@/lib/utils'
5
6export type LineChartVariant = 'DEFAULT' | 'ACTIVE' | 'WARNING' | 'CRITICAL'
7
8export interface LineChartSeries {
9 id: string
10 label: string
11 data: number[]
12 variant?: LineChartVariant
13}
14
15export interface LineChartProps extends React.HTMLAttributes<HTMLDivElement> {
16 series: LineChartSeries[]
17 labels: string[]
18 title?: string
19 height?: number
20 min?: number
21 max?: number
22 showDots?: boolean
23 showArea?: boolean
24 showGrid?: boolean
25 showLegend?: boolean
26 animated?: boolean
27}
28
29const LEFT = 40
30const RIGHT = 8
31const TOP = 8
32const BOTTOM = 24
33
34const SERIES_COLORS = [
35 'var(--color-green)',
36 'var(--color-amber)',
37 'var(--color-red)',
38 'var(--color-blue)',
39]
40
41const VARIANT_COLORS: Record<LineChartVariant, string> = {
42 DEFAULT: 'var(--text-secondary)',
43 ACTIVE: 'var(--color-green)',
44 WARNING: 'var(--color-amber)',
45 CRITICAL: 'var(--color-red)',
46}
47
48function seriesColor(s: LineChartSeries, idx: number): string {
49 if (s.variant) return VARIANT_COLORS[s.variant]
50 return SERIES_COLORS[idx % SERIES_COLORS.length]
51}
52
53const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>(
54 (
55 {
56 className,
57 series,
58 labels,
59 title,
60 height = 160,
61 min,
62 max,
63 showDots = true,
64 showArea = false,
65 showGrid = true,
66 showLegend,
67 animated = true,
68 style,
69 ...props
70 },
71 ref
72 ) => {
73 const containerRef = React.useRef<HTMLDivElement>(null)
74 const [svgW, setSvgW] = React.useState(500)
75 const [drawn, setDrawn] = React.useState(false)
76
77 React.useEffect(() => {
78 if (!containerRef.current) return
79 const ro = new ResizeObserver(entries => {
80 setSvgW(entries[0].contentRect.width)
81 })
82 ro.observe(containerRef.current)
83 return () => ro.disconnect()
84 }, [])
85
86 React.useEffect(() => {
87 const id = requestAnimationFrame(() => setDrawn(true))
88 return () => cancelAnimationFrame(id)
89 }, [])
90
91 const allValues = series.flatMap(s => s.data)
92 const dataMin = allValues.length > 0 ? Math.min(...allValues) : 0
93 const dataMax = allValues.length > 0 ? Math.max(...allValues) : 100
94 const minV = min ?? dataMin
95 const maxV = max ?? dataMax
96 const range = Math.max(maxV - minV, 1)
97
98 const plotW = svgW - LEFT - RIGHT
99 const plotH = height - TOP - BOTTOM
100 const n = labels.length
101
102 function xPos(i: number) {
103// … truncated

Facts

Registry
scificn
Type
registry:ui
Access
Free
Files written
0
Licence
the repository states none
In the index
at or before 2026-08-10
Last confirmed
yesterday

Go to the source

Docs on scificn www.scificn.dev baxy5/scificn-ui on GitHub Raw registry item This item as JSON

More from scificn

All 33 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AlertalertscificnComponentsFree1 dep
BadgebadgescificnComponentsFree1 dep
Bar Chartbar-chartscificnComponentsFreeno deps
BreadcrumbbreadcrumbscificnComponentsFreeno deps
ButtonbuttonscificnComponentsFree2 deps
CardcardscificnComponentsFreeno deps
CheckboxcheckboxscificnComponentsFree1 dep
DialogdialogscificnComponentsFree1 dep

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

KitGrade

SaaS starter kits, scored from measured facts

kitgrade.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex