RayCraftDocs
v1.0.3 raycraft.dev
On this page

CodeBlock

Free

Shows source code with light syntax coloring (C#, JavaScript, TypeScript, JSON, HTML, SCSS, SQL and shell), optional line numbers and a copy button. Colors come from theme tokens, so contrast holds in both themes.

Example

CodeBlock control

Parameters

ParameterTypeDescription
ClassstringExtra CSS classes added to the root element.
CodestringThe source text.
Languagestringcsharp, javascript, typescript, json, html, scss, sql or bash; anything else is shown uncolored.
ShowCopyboolShows the copy button (default true).
ShowLineNumbersboolShows a number before each line.
StylestringInline style added to the root element.
TitlestringText in the header; defaults to the language.

Package

CodeBlock is part of RayCraft Free. Package: RayCraft.Blazor. It comes from nuget.org. See Getting started.