@codesandbox/sandpack-react
Version:
<img style="width:100%" src="https://user-images.githubusercontent.com/4838076/143581035-ebee5ba2-9cb1-4fe8-a05b-2f44bd69bb4b.gif" alt="Component toolkit for live running code editing experiences" />
31 lines (30 loc) • 1.08 kB
TypeScript
import type { SandpackClient } from "@codesandbox/sandpack-client";
import * as React from "react";
export interface PreviewProps {
style?: React.CSSProperties;
showNavigator?: boolean;
showOpenInCodeSandbox?: boolean;
showRefreshButton?: boolean;
showRestartButton?: boolean;
/**
* Whether to show the `<ErrorOverlay>` component on top of
* the preview, if a runtime error happens.
*/
showSandpackErrorOverlay?: boolean;
showOpenNewtab?: boolean;
actionsChildren?: JSX.Element;
children?: JSX.Element;
startRoute?: string;
}
export interface SandpackPreviewRef {
/**
* Retrieve the current Sandpack client instance from preview
*/
getClient: () => InstanceType<typeof SandpackClient> | null;
/**
* Returns the client id, which will be used to
* initialize a client in the main Sandpack context
*/
clientId: string;
}
export declare const SandpackPreview: React.ForwardRefExoticComponent<PreviewProps & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<SandpackPreviewRef>>;