--- title: "Code Block" description: "Allows you to render highlighted code snippets" component: true --- ## Usage --- ```tsx import { CodeBlock } from "@medusajs/ui" ``` ```tsx ``` ## API Reference --- ## Usage Outside Medusa Admin --- If you're using the `CodeBlock` component in a project other than the Medusa Admin, make sure to include the `TooltipProvider` somewhere up in your component tree, as the `CodeBlock.Header` component uses a [Tooltip](/components/tooltip#usage-outside-medusa-admin): ```tsx ``` ## Examples --- ### Single snippet If you want to only show a code sample for one language or API, you can choose to hide the snippet labels: ### No Header You could also choose to omit the header entirely: ### No Line Numbers ### No Copy Button