react-cdx

Code snippet preview and interactions for React.

Usage no npm install needed!

<script type="module">
  import reactCdx from 'https://cdn.skypack.dev/react-cdx';
</script>

README

React CDX

Code snippet rendering and interaction library for React.

Features

  • 💅 Styling-agnostic (raw CSS, CSS-in-JS, pre-built themes).
  • 🎯 Focused lines.
  • 💎 Interactive code tokens.

Getting started

npm install react-cdx
import React from 'react'
import { Code } from 'react-cdx'

export function Example() {
  return (
    <Code
      code={`
function multiply(a, b) {
  return a * b
}
    `}
    />
  )
}