> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Add Code to Custom Panels in Blocks ## Article: Adding Code to Your Custom Panels ## Article Link: https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/editor-experience-panels/add-code-to-custom-panels-in-blocks.md ## Article Content: # Add Code to Custom Panels in Blocks
**Editor compatibility** Wix Blocks apps aren't supported in the Wix Harmony editor. Existing Blocks apps remain available for purchase on the Wix App Market for Wix Editor and Wix Studio sites. To learn more, see [About Wix Harmony and Blocks](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/about-wix-harmony-and-blocks.md).Create custom panels for action buttons in your widget and its elements. When a Wix user clicks an action button (for example, the Settings button), the custom panel opens. You can create as many panels as you need, to provide users with various options to customize widgets. First, [design your panel](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/editor-experience-panels/design-custom-panels-in-blocks.md) and connect it to an action button. Then create your panel logic, to determine how it interacts with the widget or to control the behavior of the panel itself.
Notes: - You cannot test panels in the Blocks preview. To see your panel in action, [test it on a site](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/deploy-and-manage-blocks-apps/test-your-app-on-a-site.md). - You can [connect panel elements to properties](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/editor-experience-panels/connect-panel-elements-to-props.md) and [set panel buttons to open pages](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/editor-experience-panels/panel-button-rules-to-open-pages.md) with no code. - See the [panel elements $w reference](https://www.wix.com/velo/reference/$w/panelbutton).
Examples: To see examples of custom panels, open the following app templates and go to the **Editor Experience**  tab. - [Repeater app](https://dev.wix.com/apps-templates/template?id=a4a7246f-4644-48ce-81e7-2a86aa74d9e5&http_referrer=documentation): Panel for changing the widget layout. - [Events Map app](https://dev.wix.com/apps-templates/template?id=f086effa-64b8-4c8b-a5c8-61c3a7548af7&http_referrer=documentation): Settings panel. - [Recipe List app](https://dev.wix.com/apps-templates/template?id=512a7d8a-1666-40c2-9586-25874d2f69b4&http_referrer=documentation): Settings panel that also links to a dashboard page. - [Banner app](https://dev.wix.com/apps-templates/template?id=1b7db962-6230-46bf-b908-d988ef640238&http_referrer=documentation): Panel for adding and removing elements. - [Pie Chart app](https://dev.wix.com/apps-templates/template?id=9a55382c-c755-4f01-bda2-80b85630acdd&http_referrer=documentation&http_referrer=documentation): Settings panel for custom element in Blocks.## To add code to your custom panel: 1. Go to **Editor Experience**  in the left menu and select the **Panels** tab. 2. Make sure that your panel is selected in the **Panels** section on the left menu (or [create a new panel](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/editor-experience-panels/design-custom-panels-in-blocks.md), if you haven't created it yet).  3. Go to your panel's code section and write your code there. 
Note: If you are working with the Blocks-CLI integration, write your panel code in the [panel.ts file](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-cli/supported-extensions/site-extensions/blocks-site-widgets/panel-files-and-code.md).## Panel elements Custom panels are made of unique user interface (UI) elements, such as buttons, checkboxes, drop-down lists and more. See the [list of elements](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/editor-experience-panels/panel-elements-in-blocks.md) and the [$w reference for all panel elements](https://www.wix.com/velo/reference/$w/panelbutton). ## SDK and Velo modules for Blocks custom panels To enable panel elements to interact with your widget and perform actions in the editor, you can use the following modules: ### `widget` Module The [`widget`](https://dev.wix.com/docs/sdk/host-modules/editor/widget/introduction.md) SDK module provides functionality to: - Manage widget properties and settings - Control widget design presets and appearance Import the module using: ```javascript import { widget } from '@wix/editor'; ``` ### `wix-editor` Module The [`wix-editor`](https://www.wix.com/velo/reference/wix-editor) module provides functionality to: - Remove or restore widget elements from the editor - Open Dashboard panels and navigate between editor views - Interact with the editor environment and manage element visibility Import the module using: ```javascript import wixEditor from 'wix-editor' ``` ## Interact with widget properties Panels are often used to manipulate your [widget API properties](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/widget-api/blocks-widget-properties.md). This means that when users change something in the panel, the property values change. You can connect panel elements to properties easily, [with no code](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/editor-experience-panels/connect-panel-elements-to-props.md). You can also connect panel elements with code. In this example, users can turn a "special sale" property on and off, through a toggle element in the widget's panel. ```javascript import { widget } from '@wix/editor'; $w.onReady(async function () { const saleIndicator = await widget.getProp('saleIndicator'); if (saleIndicator === "No Sale") { $w("#panelToggleSwitch1").checked = false; } }); $w("#panelToggleSwitch1").onChange(async () => { if ($w("#panelToggleSwitch1").checked) { await widget.setProp('saleIndicator', "Sale"); } else { await widget.setProp('saleIndicator', "No Sale"); } }); ```