Chart Grid
bklit-ui/gridFreeComponent
Grid lines for charts
Install it
npx shadcn@latest add https://bklit.com/r/grid.jsonSource
1"use client";23import { GridColumns, GridRows } from "@visx/grid";4import { motion } from "motion/react";5import { useId } from "react";6import { chartCssVars, useChartStable, useYScale } from "./chart-context";7import { useGridShimmer } from "./use-grid-shimmer";8import {9 isLoadingChromePhase,10 isLoadingGridChromePhase,11} from "./y-domain-utils";1213const DEFAULT_SHIMMER_LENGTH_PX = 140;14const DEFAULT_SHIMMER_SPEED = 1;15const DEFAULT_SHIMMER_STROKE =16 "color-mix(in oklch, var(--foreground) 68%, transparent)";1718export interface GridProps {19 /** Show horizontal grid lines. Default: true */20 horizontal?: boolean;21 /** Show vertical grid lines. Default: false */22 vertical?: boolean;23 /** Number of horizontal grid lines. Default: 5 */24 numTicksRows?: number;25 /** Number of vertical grid lines. Default: 10 */26 numTicksColumns?: number;27 /** Explicit tick values for horizontal grid lines. Overrides numTicksRows. */28 rowTickValues?: number[];29 /** Grid line stroke color. Default: var(--chart-grid) */30 stroke?: string;31 /** Grid stroke while loading chrome is active. Falls back to `stroke`. */32 loadingStroke?: string;33 /** Grid line stroke opacity. Default: 1 */34 strokeOpacity?: number;35 /** Grid line stroke width. Default: 1 */36 strokeWidth?: number;37 /** Grid line dash array. Default: "4,4" for dashed lines */38 strokeDasharray?: string;39 /** Horizontal row values rendered with alternate styling (e.g. zero baseline). */40 highlightRowValues?: number[];41 /** Stroke for highlighted rows. Default: var(--chart-foreground-muted) */42 highlightRowStroke?: string;43 /** Stroke opacity for highlighted rows. Default: 1 */44 highlightRowStrokeOpacity?: number;45 /** Stroke width for highlighted rows. Default: 1 */46 highlightRowStrokeWidth?: number;47 /** Dash array for highlighted rows. Default: solid line */48 highlightRowStrokeDasharray?: string;49 /** Enable horizontal fade effect on grid rows (fades at left/right). Default: true */50 fadeHorizontal?: boolean;51 /** Enable vertical fade effect on grid columns (fades at top/bottom). Default: false */52 fadeVertical?: boolean;53 /** Omit the first and last horizontal grid lines. Default: false */54 hideHorizontalEdgeLines?: boolean;55 /** Omit the first and last vertical grid lines. Default: false */56 hideVerticalEdgeLines?: boolean;57 /** Y-scale for horizontal grid lines. Default: primary (`"left"`) axis. */58 yAxisId?: string | number;59// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from bklit-ui
All 56 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Area Chartarea-chart | bklit-ui | Components | Free | 4 deps · 14 files | |
| Chart Backgroundbackground | bklit-ui | Components | Free | 2 deps · 3 files | |
| Bar Chartbar-chart | bklit-ui | Components | Free | 4 deps · 13 files | |
| Bar Depthbar-depth | bklit-ui | Components | Free | 1 dep | |
| Candlestick Chartcandlestick-chart | bklit-ui | Components | Free | 4 deps · 4 files | |
| Chart Animationchart-animation | bklit-ui | Components | Free | 1 dep · 7 files | |
| Chart Contextchart-context | bklit-ui | Components | Free | 5 deps · 12 files | |
| Chart Series Layerchart-series | bklit-ui | Components | Free | 3 deps · 15 files |
