UNPKG

react-code-canvas

Version:

Package to run and preview React code with live editing capabilities in a browser.

15 lines (14 loc) 680 B
import React, { ComponentPropsWithoutRef } from 'react'; import Editor from 'react-simple-code-editor'; import { Language, Theme, PrismLib } from './types'; type EditorProps = ComponentPropsWithoutRef<typeof Editor>; export type CodeEditorProps = Partial<Omit<EditorProps, 'defaultValue' | 'value' | 'onValueChange' | 'onChange'>> & { defaultValue?: string; value?: string; language?: Language; theme?: Theme; Prism?: PrismLib; onChange?: (value: string) => void; }; export declare const CodeEditor: ({ defaultValue, value: controlledValue, language, theme, Prism, highlight, padding, onChange, ...rest }: CodeEditorProps) => React.JSX.Element; export {};