tuil
ReferenceComponentsLogs, JSON, and diffs

CodeViewerProps

CodeViewerProps component contract.

View rawEdit

Type

export interface CodeViewerProps {
  readonly source: string;
  readonly language?: string;
  readonly width?: number;
  readonly lineNumbers?: boolean;
  readonly theme?: CodeTheme;
  readonly id?: string;
  readonly label?: string;
  readonly autoFocus?: boolean;
  readonly wrap?: boolean;
  readonly horizontalOffset?: number;
  readonly foldedLines?: ReadonlySet<number>;
  readonly search?: string | RegExp;
  readonly clipboard?: {
    write(value: string): void | Promise<void>;
  };
  readonly onCopy?: (value: string) => void | Promise<void>;
  readonly selectedLine?: number;
  readonly onSelectedLineChange?: (line: number) => void | Promise<void>;
}

Members

MemberTypeRequiredDescriptionRelated types
sourcestringYesThe source member uses the string contract.—
languagestring | undefinedNoThe language member uses the string | undefined contract.—
widthnumber | undefinedNoThe width member uses the number | undefined contract.—
lineNumbersboolean | undefinedNoThe lineNumbers member uses the boolean | undefined contract.—
themeCodeTheme | undefinedNoThe theme member uses the CodeTheme | undefined contract.CodeTheme
idstring | undefinedNoThe id member uses the string | undefined contract.—
labelstring | undefinedNoThe label member uses the string | undefined contract.—
autoFocusboolean | undefinedNoThe autoFocus member uses the boolean | undefined contract.—
wrapboolean | undefinedNoThe wrap member uses the boolean | undefined contract.—
horizontalOffsetnumber | undefinedNoThe horizontalOffset member uses the number | undefined contract.—
foldedLinesReadonlySet<number> | undefinedNoThe foldedLines member uses the ReadonlySet<number> | undefined contract.—
searchstring | RegExp | undefinedNoThe search member uses the string | RegExp | undefined contract.—
clipboard&#123; write(value: string): void | Promise<void>; &#125; | undefinedNoThe clipboard member uses the &#123; write(value: string): void | Promise<void>; &#125; | undefined contract.—
onCopy((value: string) => void | Promise<void>) | undefinedNoThe onCopy member uses the ((value: string) => void | Promise<void>) | undefined contract.—
selectedLinenumber | undefinedNoThe selectedLine member uses the number | undefined contract.—
onSelectedLineChange((line: number) => void | Promise<void>) | undefinedNoThe onSelectedLineChange member uses the ((line: number) => void | Promise<void>) | undefined contract.—

Source

View the secondary source reference

On this page