Glossary
 » 
No-code/low-code
 » 
Custom Code Block

Custom Code Block

No-code/low-code

Learn what a custom code block is in no-code, how it works in Bubble, Webflow, and FlutterFlow, and when to use it for advanced features.

A Custom Code Block in Bubble is a workflow action that lets you write and execute JavaScript directly inside a Bubble workflow. It bridges the gap between no-code and custom code when built-in actions are not enough.

Bubble covers most use cases with visual actions, but some logic or integrations require custom JavaScript. The Custom Code Block gives you that option without leaving the Bubble environment.

 

Key Takeaways

  • JavaScript execution: A Custom Code Block runs JavaScript inside a Bubble workflow, giving you access to browser APIs and custom logic.
  • Workflow integration: The block sits inside a standard workflow and can receive inputs and return outputs that other workflow steps can use.
  • Browser-side only: Custom Code Blocks run in the user's browser, not on Bubble's servers, so they are limited to client-side JavaScript capabilities.
  • Plugin alternative: Before writing custom code, check Bubble's plugin marketplace. A plugin may already solve the problem without any code being needed.

 

What is Custom Code Block in Bubble?

 

A Custom Code Block in Bubble is a "Run JavaScript" workflow action that executes custom JavaScript code in the user's browser during a workflow run. It lets builders add logic that Bubble's native actions cannot handle on their own.

 

Most Bubble apps never need custom code. But when a specific integration, browser API, or calculation falls outside what Bubble's visual tools support, the Custom Code Block provides a clean escape hatch.

  • Run JavaScript action: In the workflow editor, find the "Run JavaScript" action under the Element Actions category or via plugins like Toolbox.
  • Input variables: You pass values into the JavaScript block from Bubble's dynamic expressions, making the code aware of current user or page data.
  • Return values: The code block can return a value back to the Bubble workflow using a defined output, which subsequent steps can then use.

Custom Code Blocks are a power feature for builders who know some JavaScript. They are not required for most apps, but they are invaluable when you hit a wall with native Bubble actions.

 

How Custom Code Block Works in Bubble

 

Add a "Run JavaScript" action from the Toolbox plugin or Bubble's native actions to a workflow. Write your JavaScript in the code field, pass in any Bubble values as variables, and define the output the code should return for use in later steps.

 

The most common way to run custom code in Bubble is through the Toolbox plugin, which provides a dedicated "Run JavaScript" action with input and output support.

  • Install Toolbox: The Toolbox plugin by Bubble adds the "Run JavaScript" action to your workflow editor and is available free in the plugin marketplace.
  • Write the code: Enter your JavaScript directly in the code field. You can reference input variables you define using the properties panel for the action.
  • Capture the output: Use Toolbox's result element on the page to capture and read what the JavaScript code returns to the Bubble workflow.

JavaScript access to browser APIs like geolocation, clipboard, localStorage, and device sensors is only possible through custom code blocks in Bubble. This is where they are most commonly used in production apps.

 

Why Custom Code Block Matters for No-Code Apps

 

Custom Code Blocks extend Bubble's capabilities into territory that visual tools cannot reach. They make it possible to access browser APIs, run complex calculations, manipulate the DOM, and integrate with JavaScript-based services all without switching platforms.

 

Knowing that custom code is available when needed changes how you design Bubble apps. You can take on requirements that would otherwise force a platform switch.

  • Browser APIs: Access geolocation, clipboard, local storage, device motion, and other browser APIs that Bubble's native actions do not expose.
  • Complex calculations: Run mathematical or string processing logic that Bubble's expression builder cannot handle natively without plugin support.
  • Third-party JavaScript SDKs: Initialize and interact with JavaScript SDKs for services like analytics tools, mapping libraries, or chat widgets.

Custom Code Blocks are a signal that your app is mature enough to need custom behavior. Using them selectively keeps your app maintainable, since too much custom code in a no-code platform creates technical debt.

 

When to Use a Custom Code Block in Bubble

 

Use a Custom Code Block when a native Bubble action or plugin cannot accomplish the task, when you need access to a browser API, or when a calculation is too complex for Bubble's built-in expression system to handle cleanly.

 

The decision to use a Custom Code Block should come after checking native options. It should always be a deliberate choice, not a default one.

  • After exhausting plugins: Check the Bubble plugin marketplace first. Many common custom code needs are already covered by existing plugins with no code required.
  • For browser-specific behavior: Tasks like reading clipboard content, detecting device orientation, or accessing geolocation need JavaScript and cannot run through Bubble's native actions.
  • For unique calculations: If a formula is too complex for Bubble's expression builder, a small JavaScript function inside a code block can handle it cleanly.

When custom code is necessary, keep it short and focused. A code block that does one specific thing is easier to debug and maintain than one that handles multiple responsibilities at once.

 

Conclusion

Custom Code Blocks in Bubble give you a clean way to extend your app's functionality with JavaScript when native tools fall short. Used strategically, they make Bubble capable of nearly any client-side behavior. At LOW/CODE Agency, we've helped 450+ clients build and scale apps on Bubble and other no-code platforms. Our clients include global brands like Medtronic, American Express, Coca-Cola, Zapier, and Sotheby's.

 

Frequently Asked Questions

 

Do I need to know JavaScript to use a Custom Code Block in Bubble?

Yes. Custom Code Blocks require basic JavaScript knowledge. If you do not know JavaScript, look for a Bubble plugin that solves the same problem first.

 

Can a Custom Code Block run on Bubble's server side?

No. Custom Code Blocks run in the user's browser only. Server-side logic requires a backend workflow or an external API service.

 

Is the Toolbox plugin required for Custom Code Blocks in Bubble?

The Toolbox plugin is the most common way to add a Run JavaScript action. Bubble also has some native JavaScript-adjacent options, but Toolbox is more flexible.

 

Can a Custom Code Block access the Bubble database directly?

No. Custom code runs in the browser and cannot directly query Bubble's database. You pass data into the block through input variables defined in the workflow.

 

Are Custom Code Blocks safe to use in production Bubble apps?

Yes, when written carefully. Poorly written JavaScript can break page behavior or cause errors, so test thoroughly before deploying to live users.

 

Can I use external JavaScript libraries inside a Custom Code Block?

Yes. Load the library via a script tag in the page header, then reference its functions inside the code block once the library is initialized.

App displayed across desktop, tablet, and mobile
Ready to start your project?
Book your free discovery call and learn more about how we can help streamline your development process.
Book now
Free discovery call

FAQs

What is a custom code block in no-code?

How do custom code blocks work in Webflow?

Can you add custom code in Bubble?

Does FlutterFlow support custom code?

What is the difference between custom code blocks and plugins?

What are the risks of using custom code blocks?

Related Terms

See our numbers

315+

entrepreneurs and businesses trust LowCode Agency

Investing in custom business software pays off

33%+
Operational Efficiency
50%
Faster Decision Making
$176K/yr
In savings

I feel like I've bought a waterfront home with a beautiful view, but I'm limited to one room. I've spent all this money on samples, but I can't see what I have.

45%

reduction in time spent locating samples

70%

increase in simultaneous project management capacity

Anthony Collins, Managing Director

Anthony Collins

Managing Director

Stylecraft

Stylecraft app mockup