Deadline

Due-date marker for date x axes — a vertical line with a striped, gradient, or solid region to its right that fades out

Preview

Installation

pnpm dlx shadcn@latest add @bklit/deadline

Usage

Deadline marks a due date or point of no return: a vertical line at date, plus a region that extends right — to endDate or the plot edge — and fades out. Place it as a child of LineChart, AreaChart, ComposedChart, CandlestickChart, or a vertical BarChart with date rows. It renders in the underlay layer, behind series.

import { LineChart, Line, Grid, Deadline, ChartTooltip, XAxis } from "@bklitui/ui/charts";

<LineChart data={data}>
  <Grid horizontal />
  <Deadline date={new Date(2026, 9, 15)} label="Due Oct 15" />
  <Line dataKey="scope" />
  <Line dataKey="completed" />
  <XAxis />
  <ChartTooltip />
</LineChart>

The colour defaults to --chart-negative (red), with a fallback to --color-red-500 when the token is missing. The fade gradient is pinned to the region's data coordinates, so it stays in place while you brush or pan. On bar charts the line sits on the left edge of the first column on or after date.

Props

PropTypeDefaultDescription
dateDate | number | stringrequiredMarker date (left edge of the region)
endDateDate | number | string—Region end (plot right edge when omitted)
colorstringvar(--chart-negative)Line and fill colour
fillType"pattern" | "gradient" | "solid" | "none""pattern"Region fill; "none" draws only the line
fillOpacitynumber0.6 (pattern), 0.25 (gradient), 0.12 (solid)Region opacity
gradientToOpacitynumber0gradient only — opacity at the region's right edge
patternPattern preset id"diagonal"Pattern when fillType is "pattern"
patternScalenumber1.5Pattern tile scale
patternStrokeWidthnumber1Stripe width
fadebooleantrueFade the region out towards its right edge
fadeLengthnumber0.5Fraction (0–1) of the region, from the right, that fades
showLinebooleantrueDraw the vertical marker line
strokestringcolorLine colour
strokeWidthnumber1Line width
strokeDasharraystring—Dash array for a dashed line
strokeOpacitynumber1Line opacity
labelstring—Text beside the line (flips to the left near the right edge)
labelPosition"top" | "bottom""top"Label placement
labelColorstringcolorLabel colour
dateKeystringautoBand (bar) scales only — data key holding each row's date
classNamestring—Class on the root <g>

Studio

Edit in Studio

Open in Studio

Open Studio with the line chart and toggle the Deadline layer (eye icon) in the layers panel to set its position, label, fill type, fade, and line style. The same layer is available on area and composed charts.

Examples

Fill types

fillType="pattern"
fillType="gradient"
fillType="solid"
<Deadline date={dueDate} fillType="pattern" /><Deadline date={dueDate} fillType="gradient" /><Deadline date={dueDate} fillType="solid" />

Area chart with weekends

<AreaChart data={data}>  <Grid horizontal />  <Weekends />  <Deadline date={new Date(2026, 9, 15)} fillType="gradient" />  <Area dataKey="completed" fill="var(--chart-1)" />  <XAxis />  <ChartTooltip /></AreaChart>

See Weekends for brush-zoom, bar chart, and composed chart examples that combine both utilities.