west Home
light_mode
MumpUI / Component / Code

PrismJS is required for code highlighting. Select the required languages from here and import the script as shown below

<html>
  <head>
    ..
  </head>
  <body>
    ..
    <script src="/prism.js" data-manual></script>
  </body>
</html>

Import code styling from MumpUI

import 'mumpui/dist/styles/code.css'

Usage example

const snippet = `
function fun () {
  return (
    <div>Hello there!</div>
  )
}`

<Code snippet={snippet} lang='jsx' />

Note
  • Do not import the CSS provided by PrismJS as styling is already setup in MumpUI.
  • Only import PrismJS languages that are actually used in your application as every language imported increases the build size.
Code component props
NameTypeUsage
..All div element props
snippetstringCode to be rendered
langstringCheck all available languages here