Skip to main content
ReferenceLine
@coinbase/cds-web-visualization@3.4.0-beta.9
A horizontal or vertical reference line to mark important values on a chart, such as targets, thresholds, or baseline values.
Import
import { ReferenceLine } from '@coinbase/cds-web-visualization'
SourceView source code
Peer dependencies
  • framer-motion: ^10.18.0
Related components
View as Markdown

Basics

ReferenceLine can be used to add important details to a chart, such as a reference price or date. You can create horizontal lines using dataY or vertical lines using dataX.

Simple Reference Line

A minimal reference line without labels, useful for marking key thresholds:

Loading...

With Labels

You can add text labels to reference lines and position them using alignment and offset props:

Loading...

Data Values

ReferenceLine relies on dataX or dataY to position the line. Passing in dataY will create a horizontal line across the y axis at that value, and passing in dataX will do the same along the x axis.

Loading...

Labels

Customization

You can customize label appearance using labelFont, labelDx, labelDy, labelHorizontalAlignment, and labelVerticalAlignment props.

Loading...

Bounds

Use labelBoundsInset to prevent labels from getting too close to chart edges.

Loading...

Custom Component

You can adjust the style of the label using a custom LabelComponent.

Loading...

Draggable Price Target

You can pair a ReferenceLine with a custom drag component to create a draggable price target.

Loading...

Is this page useful?

Coinbase Design is an open-source, adaptable system of guidelines, components, and tools that aid the best practices of user interface design for crypto products.