FinanceFI-13
Options payoff
An options strategy at expiry: profit or loss wherever the price ends, with today’s price and every breakeven marked.
- Part
- FI-13
- Component
- PayoffChartCard
- From
- @lilt-ui/charts/finance
Bull call spread
- Max profit
- +$1,370
- Max loss
- −$630
- Breakeven
- $206.30
Installation
One package, one sheet.
Add the package, then import the component and the stylesheet once. See Getting started for theming.
npm install @lilt-ui/chartsimport { PayoffChartCard } from '@lilt-ui/charts/finance';
import '@lilt-ui/charts/styles.css';
Usage
The default card.
The default card above, as you would write it.
<PayoffChartCard
title="Bull call spread"
spot={204}
legs={[
{ type: 'call', strike: 200, premium: 9.4 },
{ type: 'call', side: 'short', strike: 220, premium: 3.1 },
]}
/>
Omit title to leave out the visible title. Set header={false} to remove the whole header, and use aria-label to name a chart inside your own card. surface="ghost" controls only the visual frame. See Card composition.
Data
The shape it reads.
Every leg expires together. A long option pays its premium and a short one receives it; option quantities are contracts of multiplier shares (100 by default), and stock quantities are shares held from strike. Breakevens are found exactly where the curve crosses zero. Max profit or max loss reads Unlimited when it keeps growing as the price rises. payoffAt and payoffSummary return the same numbers for your own layouts.
// Each leg: a call, put, or stock; long (default) or short; its strike, premium and quantity.
const legs = [
{ type: 'call', strike: 200, premium: 9.4 },
{ type: 'call', side: 'short', strike: 220, premium: 3.1, quantity: 1 },
];
Props23
Every prop.
Every prop PayoffChartCard accepts, in the order you are likely to reach for them.
| Prop | Type | Description |
|---|---|---|
title | string | Optional visible title. Also names the chart unless aria-label is set. |
header | boolean | False removes the title, headline and stats. Defaults to true. |
aria-label | string | Accessible name, independent of the visible title. |
legs | { type, side?, strike, premium?, quantity? }[] | The positions, all expiring together. |
spot | number | Today’s price: marked, and read at rest. |
priceRange | [low, high] | Prices to draw. Defaults to 30% around the strikes and spot. |
multiplier | number | Shares per contract. Defaults to 100. |
valueFormat | Intl.NumberFormatOptions | Money format for profit and loss. Whole US dollars by default. |
priceFormat | Intl.NumberFormatOptions | Price format for the underlying. Defaults to valueFormat with cents. |
locale | string | Locale for numbers; defaults to en-US. |
height | number | Plot height in pixels. Defaults to 220. |
depth | boolean | Draws the payoff line as a lit tube with a soft shadow. |
axis | 'minimal' | 'dots' | 'inline' | 'ruler' | 'classic' | 'segmented' | Axis preset. |
background | 'dots' | 'grid' | 'lines' | 'none' | Texture behind the plot. |
hoverStyle | 'soft' | 'solid' | 'accent' | How the pills look. |
surface | 'elevated' | 'outline' | 'ghost' | Card treatment. |
numberStyle | 'count' | 'pop' | 'slide' | 'roll' | 'flow' | 'scramble' | Headline number animation. Count by default. |
loading | boolean | Shows a neutral loading skeleton, not data. |
loadingStyle | 'shimmer' | 'draw' | 'breathe' | Shimmer sweeps a highlight over still shapes; draw reveals them in order; breathe lets them settle. Follows the selected look, including depth, and respects reduced motion. |
empty | 'dots' | 'shape' | ReactElement | null | What the card shows when the period has no data. Dots (default) gathers a quiet dot field around the message; shape lays the chart’s own outline behind it. Pass `<ChartEmpty>` with your own words, any element of your own, or null for nothing. Both looks stay still, so empty never reads as loading, and the headline reads a dash, never zero. |
motion | 'auto' | 'none' | None turns off decorative motion. |
className | string | Class on the card frame. |
style | CSSProperties | ChartStyle | Inline styles and scoped chart variables. |