---
title: "Creating custom components"
date: "2025-07-25T07:21:22+00:00"
summary: "Learn to create custom components in Drupal Canvas by overriding existing ones or building from scratch for maximum flexibility."
image:
type: "page"
url: "/acquia-source/creating-custom-components"
id: "37bd0daf-d050-4702-b0c3-ccde1eb2682f"
---

The following are the approaches for creating custom components in Drupal Canvas:

*   **Start with an existing component**: Use components included in site templates as a foundation for implementing custom branded components. This approach is effective when you require a component similar to an existing one but with specific modifications.
*   **Creating a component from scratch**: This approach provides you complete control to build a custom component to your exact specifications. It requires more technical knowledge but provides maximum flexibility.

Sharing custom components across sites
--------------------------------------

The Drupal Canvas CLI tool enables you to create, build, and manage code components outside of the browser-based code editor provided by Acquia Source. It also enables you to manage a single component library used by multiple sites.

### Setting up the CLI tool

1.  In a terminal window, run the following command to install the CLI tool:
    
        npm install @drupal-canvas/cli -g
    
2.  [Access your site](/node/69836#access-a-site).
3.  In the left sidebar, click **API** \> **API clients**.
4.  Click **Add API client**.
5.  Enter a name.
6.  Select the **Client Credentials** checkbox and add `canvas:asset_library` and `canvas:js_component` as scopes.
7.  Save the client to generate credentials.
8.  Use the credentials to download and upload components such as npx canvas download.
    
    For detailed usage information, refer to the [npm package](https://www.npmjs.com/package/@drupal-canvas/cli).