Rate this page:
An entire block of formatted code, highlighted in the body text.
1 2import ForgeUI, { Code } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
text | string | Yes | The code to be formatted. |
language | string | The language in which the code is written. |
The code
component currently supports the following programming languages:
"abap", "actionscript", "ada", "arduino", "autoit", "c", "c++", "coffeescript", "csharp", "css", "cuda", "d", "dart", "delphi", "elixir", "erlang", "fortran", "foxpro", "go", "graphql", "groovy", "haskell", "haxe", "html", "java", "javascript", "json", "julia", "kotlin", "latex", "livescript", "lua", "mathematica", "matlab", "objective-c", "objective-j", "objectpascal", "ocaml", "octave", "perl", "php", "powershell", "prolog", "puppet", "python", "qml", "r", "racket", "restructuredtext", "ruby", "rust", "sass", "scala", "scheme", "shell", "smalltalk", "sql", "standardml", "swift", "tcl", "tex", "text", "typescript", "vala", "vbnet", "verilog", "vhdl", "xml", "xquery"
1 2const App = () => { const exampleCodeBlock = ` // React Component class HelloMessage extends React.Component { render() { return ( <div> Hello {this.props.name} </div> ); } } ReactDOM.render( <HelloMessage name="Taylor" />, mountNode ); `; return ( <Code text={exampleCodeBlock} language="javascript" /> ); };
Rate this page: