CodeEditor
Edits code with syntax highlighting for multiple programming languages.
import { CodeEditor } from '@lobehub/ui';Data Entry
CodeEditor is a component for editing code with syntax highlighting support for various programming languages.
Default
Loading preview
APIs
CodeEditor properties
classNames{ highlight?: string; textarea?: string; }defaultValuestringDefaults to
"".flexIFlexboxstring | numberflex 值
Defaults to
"0 1 auto".heightIFlexboxstring | number高度
Defaults to
"auto".languageRequiredstringDefaults to
"markdown".onValueChangeRequired(value: string) => voidplaceholderstringDefaults to
"".refnull | (instance: HTMLTextAreaElement | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES] | RefObject<HTMLTextAreaElement | null>styleCSSPropertiesstyles{ highlight?: CSSProperties; textarea?: CSSProperties; }valueRequiredstringvariant'filled' | 'outlined' | 'borderless'Defaults to
"borderless".widthIFlexboxstring | number宽度
Defaults to
"auto".
Also accepts all native HTML and ARIA attributes.
CodeEditor also inherits some properties from TextArea and Flexbox components
Helpful?