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:
Feedback
Your feedback is most valuable contribution to the project, please share how you use Mantine, what features are missing and what is done good
Leave feedback