Skip to main content
ReferenceLine
@coinbase/cds-web@9.28.0
A horizontal or vertical reference line to mark important values on a chart, such as targets, thresholds, or baseline values.
import { ReferenceLine } from '@coinbase/cds-web/visualizations/chart'
Peer dependencies
  • framer-motion: ^10.18.0
Related components

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.

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 Components​

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

Loading...

You can also optionally hide the label based on user scrubbing.

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.