"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["6408"],{57178:function(e,t,r){r.r(t),r.d(t,{metadata:()=>n,contentTitle:()=>c,default:()=>f,assets:()=>s,toc:()=>d,frontMatter:()=>u});var n=JSON.parse('{"id":"api/themes/theme-live-codeblock","title":"\uD83D\uDCE6 theme-live-codeblock","description":"This theme provides a @theme/CodeBlock component that is powered by react-live. You can read more on interactive code editor documentation.","source":"@site/docs/api/themes/theme-live-codeblock.mdx","sourceDirName":"api/themes","slug":"/api/themes/@docusaurus/theme-live-codeblock","permalink":"/docs/api/themes/@docusaurus/theme-live-codeblock","draft":false,"unlisted":false,"editUrl":"https://github.com/facebook/docusaurus/edit/main/website/docs/api/themes/theme-live-codeblock.mdx","tags":[],"version":"current","lastUpdatedBy":"S\xe9bastien Lorber","lastUpdatedAt":1729684612000,"sidebarPosition":3,"frontMatter":{"sidebar_position":3,"slug":"/api/themes/@docusaurus/theme-live-codeblock"},"sidebar":"api","previous":{"title":"\uD83D\uDCE6 theme-classic","permalink":"/docs/api/themes/@docusaurus/theme-classic"},"next":{"title":"\uD83D\uDCE6 theme-search-algolia","permalink":"/docs/api/themes/@docusaurus/theme-search-algolia"}}'),o=r("24246"),a=r("80980"),l=r("15398"),i=r("58636");let u={sidebar_position:3,slug:"/api/themes/@docusaurus/theme-live-codeblock"},c="\uD83D\uDCE6 theme-live-codeblock",s={},d=[{value:"Configuration",id:"configuration",level:3}];function p(e){let t={a:"a",code:"code",h1:"h1",h3:"h3",header:"header",p:"p",pre:"pre",...(0,a.a)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"-theme-live-codeblock",children:"\uD83D\uDCE6 theme-live-codeblock"})}),"\n",(0,o.jsxs)(t.p,{children:["This theme provides a ",(0,o.jsx)(t.code,{children:"@theme/CodeBlock"})," component that is powered by react-live. You can read more on ",(0,o.jsx)(t.a,{href:"/docs/markdown-features/code-blocks#interactive-code-editor",children:"interactive code editor"})," documentation."]}),"\n",(0,o.jsxs)(l.Z,{groupId:"npm2yarn",children:[(0,o.jsx)(i.Z,{value:"npm",children:(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-bash",children:"npm install --save @docusaurus/theme-live-codeblock\n"})})}),(0,o.jsx)(i.Z,{value:"yarn",label:"Yarn",children:(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-bash",children:"yarn add @docusaurus/theme-live-codeblock\n"})})}),(0,o.jsx)(i.Z,{value:"pnpm",label:"pnpm",children:(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-bash",children:"pnpm add @docusaurus/theme-live-codeblock\n"})})})]}),"\n",(0,o.jsx)(t.h3,{id:"configuration",children:"Configuration"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-js",metastring:'title="docusaurus.config.js"',children:"export default {\n plugins: ['@docusaurus/theme-live-codeblock'],\n themeConfig: {\n liveCodeBlock: {\n /**\n * The position of the live playground, above or under the editor\n * Possible values: \"top\" | \"bottom\"\n */\n playgroundPosition: 'bottom',\n },\n },\n};\n"})})]})}function f(e={}){let{wrapper:t}={...(0,a.a)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},58636:function(e,t,r){r.d(t,{Z:()=>l});var n=r("24246");r("27378");var o=r("90496");let a="tabItem_pnkT";function l(e){var t=e.children,r=e.hidden,l=e.className;return(0,n.jsx)("div",{role:"tabpanel",className:(0,o.Z)(a,l),hidden:r,children:t})}},15398:function(e,t,r){r.d(t,{Z:()=>w});var n=r("24246"),o=r("27378"),a=r("90496"),l=r("54947"),i=r("3620"),u=r("844"),c=r("97486"),s=r("32263"),d=r("16971");function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r child <".concat("string"==typeof e.type?e.type:e.type.name,'>: all children of the component should be , and every should have a unique "value" prop.'))}))||void 0===t?void 0:t.filter(Boolean))&&void 0!==r?r:[]}function h(e){var t=e.value;return e.tabValues.some(function(e){return e.value===t})}var m=r("71607");let v="tabList_Qoir",y="tabItem_AQgk";function g(e){for(var t=1;t0)throw Error('Docusaurus error: Duplicate values "'.concat(t.map(function(e){return e.value}).join(", "),'" found in . Every value needs to be unique.'))}(e),e},[r,n])),V=f((0,o.useState)(function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw Error("Docusaurus error: the component requires at least one children component");if(r){if(!h({value:r,tabValues:n}))throw Error('Docusaurus error: The has a defaultValue "'.concat(r,'" but none of its children has the corresponding value. Available values are: ').concat(n.map(function(e){return e.value}).join(", "),". If you intend to show no default tab, use defaultValue={null} instead."));return r}var o=null!==(t=n.find(function(e){return e.default}))&&void 0!==t?t:n[0];if(!o)throw Error("Unexpected error: 0 tabValues");return o.value}({defaultValue:w,tabValues:T})}),2),E=V[0],I=V[1];var C=f((l=(a={queryString:void 0!==P&&P,groupId:S}).queryString,p=a.groupId,m=(0,i.k6)(),v=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:void 0!==l&&l,groupId:p}),[(0,c._X)(v),(0,o.useCallback)(function(e){if(!!v){var t,r,n=new URLSearchParams(m.location.search);n.set(v,e),m.replace((t=function(e){for(var t=1;t