Chart
Recharts wrapper primitives.
packages/ui/src/components/ui/chart.tsx
Import
Subpath export:
@marktiderman/genesis-uiimport { ChartContainer } from "@marktiderman/genesis-ui";Exports
Re-exported from
@marktiderman/genesis-ui.- ChartContainer
- ChartTooltip
- ChartTooltipContent
- ChartLegend
- ChartLegendContent
Components
Auto-generated from TypeScript source via
react-docgen-typescript.ChartContainer
| Prop | Type | Default | Description |
|---|---|---|---|
| config* | ChartConfig | — | |
| initialDimension | { width: number; height: number; } | { width: 320, height: 200 } as const |
Tooltip
The Tooltip component displays a floating box with data values when hovering over or clicking on chart elements. It can be configured to show information for individual data points or for all points at a specific axis coordinate. The appearance and content of the tooltip can be customized via props.
| Prop | Type | Default | Description |
|---|---|---|---|
| active | boolean | — | If true, then Tooltip is always displayed, once an activeIndex is set by mouse over, or programmatically. If false, then Tooltip is never displayed. If undefined, Recharts will control when the Tooltip displays. This includes mouse and keyboard controls. |
| allowEscapeViewBox | AllowInDimension | — | This option allows the tooltip to extend beyond the viewBox of the chart itself. @defaultValue {"x":false,"y":false} |
| animationDuration | number | — | Specifies the duration of animation, the unit of this option is ms. @defaultValue 400 |
| animationEasing | EasingInput | — | The type of easing function. @defaultValue ease |
| axisId | AxisId | — | Tooltip always attaches itself to the "Tooltip" axis. Which axis is it? Depends on the layout: - horizontal layout -> X axis - vertical layout -> Y axis - radial layout -> radial axis - centric layout -> angle axis Tooltip will use the default axis for the layout, unless you specify an axisId. @defaultValue 0 |
| content | ContentType<ValueType, NameType> | — | Renders the content of the tooltip. This should return HTML elements, not SVG elements. - If not set, the {@link DefaultTooltipContent } component is used. - If set to a React element, this element will be cloned and extra props will be passed in. - If set to a function, the function will be called and should return HTML elements. @see {@link https://recharts.github.io/en-US/examples/CustomContentOfTooltip/ Example with custom content} |
| cursor | CursorDefinition | — | If set false, no cursor will be drawn when tooltip is active. If set a object, the option is the configuration of cursor. If set a React element, the option is the custom react element of drawing cursor. @defaultValue true |
| defaultIndex | number | TooltipIndex | — | |
| filterNull | boolean | — | When an item of the payload has value null or undefined, this item won't be displayed. @defaultValue true |
| includeHidden | boolean | — | If true, the tooltip will display information about hidden series. Defaults to false. Interacting with the hide property of Area, Bar, Line, Scatter. @defaultValue false |
| isAnimationActive | boolean | "auto" | — | If set false, animation of tooltip will be disabled. If set "auto", the animation will be disabled in SSR and will respect the user's prefers-reduced-motion system preference for accessibility. @defaultValue auto |
| offset | number | Coordinate | — | The offset size between the position of tooltip and the mouse cursor position. When a number is provided, the same offset is applied to both x and y axes. When a Coordinate object is provided, you can specify different offsets for each axis (x and y as numbers) @defaultValue 10 |
| payloadUniqBy | UniqueOption<TooltipPayloadEntry> | — | |
| portal | HTMLElement | null | — | If portal is defined, then Tooltip will use this element as a target for rendering using React Portal: https://react.dev/reference/react-dom/createPortal If this is undefined then Tooltip renders inside the recharts-wrapper element. |
| position | Partial<Coordinate> | — | If this field is set, the tooltip will be displayed at the specified position regardless of the mouse position. You can set a single field (x or y) and let the other field be calculated automatically based on the mouse position. |
| reverseDirection | AllowInDimension | — | @defaultValue {"x":false,"y":false} |
| shared | boolean | — | Defines whether the tooltip is reacting to the current data point, or to all data points at the current axis coordinate. - `true`: tooltip will appear on top of all bars on an axis tick. - `false`: tooltip will appear on individual bars. Different chart types allow different modes, and have different defaults. @see {@link https://github.com/recharts/recharts/wiki/Tooltip-event-type-and-shared-prop Tooltip event type and shared prop wiki page} |
| trigger | enum | — | If `hover` then the Tooltip shows on mouse enter and hides on mouse leave. If `click` then the Tooltip shows after clicking and stays active. @defaultValue hover |
| useTranslate3d | boolean | — | @defaultValue false |
| wrapperStyle | CSSProperties | — | CSS styles to be applied to the wrapper `div` element. |
ChartTooltipContent
| Prop | Type | Default | Description |
|---|---|---|---|
| active | boolean | — | |
| allowEscapeViewBox | AllowInDimension | — | This option allows the tooltip to extend beyond the viewBox of the chart itself. @defaultValue {"x":false,"y":false} |
| animationDuration | number | — | Specifies the duration of animation, the unit of this option is ms. @defaultValue 400 |
| animationEasing | EasingInput | — | The type of easing function. @defaultValue ease |
| axisId | AxisId | — | Tooltip always attaches itself to the "Tooltip" axis. Which axis is it? Depends on the layout: - horizontal layout -> X axis - vertical layout -> Y axis - radial layout -> radial axis - centric layout -> angle axis Tooltip will use the default axis for the layout, unless you specify an axisId. @defaultValue 0 |
| content | ContentType<ValueType, NameType> | — | Renders the content of the tooltip. This should return HTML elements, not SVG elements. - If not set, the {@link DefaultTooltipContent } component is used. - If set to a React element, this element will be cloned and extra props will be passed in. - If set to a function, the function will be called and should return HTML elements. @see {@link https://recharts.github.io/en-US/examples/CustomContentOfTooltip/ Example with custom content} |
| cursor | CursorDefinition | — | If set false, no cursor will be drawn when tooltip is active. If set a object, the option is the configuration of cursor. If set a React element, the option is the custom react element of drawing cursor. @defaultValue true |
| defaultIndex | number | TooltipIndex | — | |
| filterNull | boolean | — | When an item of the payload has value null or undefined, this item won't be displayed. @defaultValue true |
| formatter | ((value: any, name: any, item: any, index: number, payload: any) => ReactNode) | — | |
| hideIndicator | boolean | false | |
| hideLabel | boolean | false | |
| includeHidden | boolean | — | If true, the tooltip will display information about hidden series. Defaults to false. Interacting with the hide property of Area, Bar, Line, Scatter. @defaultValue false |
| indicator | enum | dot | |
| isAnimationActive | boolean | "auto" | — | If set false, animation of tooltip will be disabled. If set "auto", the animation will be disabled in SSR and will respect the user's prefers-reduced-motion system preference for accessibility. @defaultValue auto |
| label | unknown | — | |
| labelClassName | string | — | |
| labelFormatter | ((label: any, payload: any[]) => ReactNode) | — | |
| labelKey | string | — | |
| nameKey | string | — | |
| offset | number | Coordinate | — | The offset size between the position of tooltip and the mouse cursor position. When a number is provided, the same offset is applied to both x and y axes. When a Coordinate object is provided, you can specify different offsets for each axis (x and y as numbers) @defaultValue 10 |
| payload | readonly ChartPayloadItem[] | — | |
| payloadUniqBy | UniqueOption<TooltipPayloadEntry> | — | |
| portal | HTMLElement | null | — | If portal is defined, then Tooltip will use this element as a target for rendering using React Portal: https://react.dev/reference/react-dom/createPortal If this is undefined then Tooltip renders inside the recharts-wrapper element. |
| position | Partial<Coordinate> | — | If this field is set, the tooltip will be displayed at the specified position regardless of the mouse position. You can set a single field (x or y) and let the other field be calculated automatically based on the mouse position. |
| reverseDirection | AllowInDimension | — | @defaultValue {"x":false,"y":false} |
| shared | boolean | — | Defines whether the tooltip is reacting to the current data point, or to all data points at the current axis coordinate. - `true`: tooltip will appear on top of all bars on an axis tick. - `false`: tooltip will appear on individual bars. Different chart types allow different modes, and have different defaults. @see {@link https://github.com/recharts/recharts/wiki/Tooltip-event-type-and-shared-prop Tooltip event type and shared prop wiki page} |
| trigger | enum | — | If `hover` then the Tooltip shows on mouse enter and hides on mouse leave. If `click` then the Tooltip shows after clicking and stays active. @defaultValue hover |
| useTranslate3d | boolean | — | @defaultValue false |
| wrapperStyle | CSSProperties | — | CSS styles to be applied to the wrapper `div` element. |
ChartLegend
| Prop | Type | Default | Description |
|---|---|---|---|
| content | ContentType | — | Renders the content of the legend. This should return HTML elements, not SVG elements. - If not set, the {@link DefaultLegendContent } component is used. - If set to a React element, this element will be cloned and extra props will be passed in. - If set to a function, the function will be called and should return HTML elements. @example <Legend content={CustomizedLegend} /> @example <Legend content={renderLegend} /> |
| dangerouslySetInnerHTML | { __html: string; } | — | |
| height | string | number | — | Height of the legend. Accept CSS style string values like `100%` or `fit-content`, or number values like `400`. |
| itemSorter | LegendItemSorter | null | — | Sorts Legend items. Defaults to `value` which means it will sort alphabetically by the label. If `null` is provided then the payload is not sorted. Be aware that without sort, the order of items may change between renders! @defaultValue value |
| layout | enum | — | The layout of legend items inside the legend container. When `auto` then the layout is decided based on the `position` prop: - in `left`|`right` positions, the layout is vertical - otherwise horizontal - if position is undefined, also horizontal `auto` value is new since 3.10 @defaultValue auto |
| offset | number | — | The offset to the specified `position`. Direction of the offset depends on the position. @since 3.10 |
| onAbort | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAbortCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAnimationEnd | AdaptChildAnimationEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAnimationEndCapture | AdaptChildAnimationEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAnimationIteration | AdaptChildAnimationEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAnimationIterationCapture | AdaptChildAnimationEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAnimationStart | AdaptChildAnimationEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAnimationStartCapture | AdaptChildAnimationEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAuxClick | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onAuxClickCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onBBoxUpdate | ((box: ElementOffset | null) => void) | — | |
| onBeforeInput | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onBeforeInputCapture | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onBlur | AdaptChildFocusEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onBlurCapture | AdaptChildFocusEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCanPlay | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCanPlayCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCanPlayThrough | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCanPlayThroughCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onChange | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onChangeCapture | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onClickCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCompositionEnd | AdaptChildCompositionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCompositionEndCapture | AdaptChildCompositionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCompositionStart | AdaptChildCompositionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCompositionStartCapture | AdaptChildCompositionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCompositionUpdate | AdaptChildCompositionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCompositionUpdateCapture | AdaptChildCompositionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onContextMenu | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onContextMenuCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCopy | AdaptChildClipboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCopyCapture | AdaptChildClipboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCut | AdaptChildClipboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onCutCapture | AdaptChildClipboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDoubleClick | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDoubleClickCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDrag | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragEnd | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragEndCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragEnter | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragEnterCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragExit | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragExitCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragLeave | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragLeaveCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragOver | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragOverCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragStart | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDragStartCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDrop | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDropCapture | AdaptChildDragEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDurationChange | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onDurationChangeCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onEmptied | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onEmptiedCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onEncrypted | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onEncryptedCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onEnded | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onEndedCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onError | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onErrorCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onFocus | AdaptChildFocusEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onFocusCapture | AdaptChildFocusEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onGotPointerCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onGotPointerCaptureCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onInput | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onInputCapture | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onInvalid | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onInvalidCapture | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onKeyDown | AdaptChildKeyboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onKeyDownCapture | AdaptChildKeyboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onKeyPress | AdaptChildKeyboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onKeyPressCapture | AdaptChildKeyboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onKeyUp | AdaptChildKeyboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onKeyUpCapture | AdaptChildKeyboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoad | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoadCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoadedData | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoadedDataCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoadedMetadata | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoadedMetadataCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoadStart | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLoadStartCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLostPointerCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onLostPointerCaptureCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseDown | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseDownCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseMove | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseMoveCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseOut | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseOutCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseOver | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseOverCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseUp | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onMouseUpCapture | AdaptChildMouseEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPaste | AdaptChildClipboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPasteCapture | AdaptChildClipboardEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPause | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPauseCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPlay | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPlayCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPlaying | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPlayingCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerCancel | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerCancelCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerDown | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerDownCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerEnter | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerEnterCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerLeave | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerLeaveCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerMove | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerMoveCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerOut | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerOutCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerOver | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerOverCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerUp | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onPointerUpCapture | AdaptChildPointerEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onProgress | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onProgressCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onRateChange | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onRateChangeCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onReset | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onResetCapture | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onScroll | AdaptChildUIEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onScrollCapture | AdaptChildUIEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSeeked | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSeekedCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSeeking | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSeekingCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSelect | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSelectCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onStalled | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onStalledCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSubmit | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSubmitCapture | AdaptChildFormEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSuspend | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onSuspendCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTimeUpdate | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTimeUpdateCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchCancel | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchCancelCapture | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchEnd | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchEndCapture | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchMove | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchMoveCapture | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchStart | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTouchStartCapture | AdaptChildTouchEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTransitionEnd | AdaptChildTransitionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onTransitionEndCapture | AdaptChildTransitionEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onVolumeChange | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onVolumeChangeCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onWaiting | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onWaitingCapture | AdaptChildReactEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onWheel | AdaptChildWheelEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| onWheelCapture | AdaptChildWheelEventHandler<LegendPayload, ReactElement<unknown, string | JSXElementConstructor<any>>> | — | |
| payloadUniqBy | UniqueOption<LegendPayload> | — | |
| portal | HTMLElement | null | — | If portal is defined, then Legend will use this element as a target for rendering using React Portal. If this is undefined then Legend renders inside the recharts-wrapper element. @see {@link https://react.dev/reference/react-dom/createPortal} |
| position | CartesianPosition | — | The position of the legend relative to the chart. If this is defined, it overrides `align` and `verticalAlign`. @since 3.10 |
| verticalAlign | enum | — | @deprecated use `position` instead which has more options, is more flexible and has more intuitive default styles. @description The alignment of the whole Legend container: - `bottom`: shows the Legend below chart, and chart height reduces automatically to make space for it. - `top`: shows the Legend above chart, and chart height reduces automatically. - `middle`: shows the Legend in the middle of chart, covering other content, and chart height remains unchanged. The exact behavior changes depending on `align` prop. @defaultValue bottom @see {@link https://recharts.github.io/examples/LegendPosition/ Legend position playground} |
| width | string | number | — | Width of the legend. Accept CSS style string values like `100%` or `fit-content`, or number values like `400`. |
| wrapperStyle | CSSProperties | — | CSS styles to be applied to the wrapper `div` element. |
ChartLegendContent
| Prop | Type | Default | Description |
|---|---|---|---|
| hideIcon | boolean | false | |
| nameKey | string | — | |
| payload | readonly ChartPayloadItem[] | — | |
| verticalAlign | enum | bottom |
ChartStyle
ChartStyle injects scoped CSS custom properties for chart colors. NOTE: Uses dangerouslySetInnerHTML intentionally -- this is the standard Shadcn/UI pattern. The content is derived entirely from the developer- provided ChartConfig (compile-time data), never from user input.
| Prop | Type | Default | Description |
|---|---|---|---|
| config* | ChartConfig | — | |
| id* | string | — |