Code
Inline or block code without syntax highlight
Import
Source
Docs
Package
Inline code
By default, Code component renders inline code html element:
React.createElement()Block code
To render code in pre element pass block prop to Code component:
import React from 'react';
import { Code } from '@mantine/core';
function Demo() {
return <Code>React.createElement()</Code>;
}Custom color
By default, code has gray color, you can change it to any color from theme.colors:
React.createElement()React.createElement()React.createElement()Syntax highlight
In case you need syntax highlight like in all code examples on Mantine website, use @mantine/prism package: