Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/factory.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ export interface PlotParams {
* Build a Plot component bound to a specific plotly.js instance. Use this
* when shipping a custom plotly.js bundle (e.g. the basic, cartesian, or
* a custom partial bundle) instead of the full library.
*
* The returned component is `forwardRef`-wrapped, so consumers can attach a
* ref to access the underlying graph div (e.g. for `Plotly.animate` calls
* outside the React update cycle).
*/
declare function createPlotlyComponent(Plotly: unknown): React.ComponentType<PlotParams>;
declare function createPlotlyComponent(
Plotly: unknown
): React.ForwardRefExoticComponent<
PlotParams & React.RefAttributes<HTMLDivElement>
>;

export default createPlotlyComponent;
4 changes: 3 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type React from 'react';
import type {PlotParams} from './factory';

declare const Plot: React.ComponentType<PlotParams>;
declare const Plot: React.ForwardRefExoticComponent<
PlotParams & React.RefAttributes<HTMLDivElement>
>;

export default Plot;
export {Figure, FigureCallback, EventCallback, PlotParams} from './factory';
Loading