# Enable/Disable Ribbon Elements

A tutorial showing how to enable or disable ribbon elements in the SpreadJS Designer Component, including UI and code examples

## Content

Follow the below steps to disable the "Table" field button from the "INSERT" tab.

1. Access the default configuration and identify the command associated with the "Table" button, in this case, the `insertTable` command.

    ```JavaScript
    // Access the default config
    var config = GC.Spread.Sheets.Designer.DefaultConfig;
    
    // Find the below snippet for "Table" button
    // "ribbon": [
    // {
    //  ...
    //
    //   "id": "insert",
    //   "text": "INSERT",
    //   "buttonGroups": [
    //     {
    //       "label": "Table",
    //       "thumbnailClass": "ribbon-thumbnail-table",
    //       "commandGroup": {
    //         "commands": [
    //           "insertTable"      // Associated command
    //         ]
    //       }
    //     }]
    // }]
    ```
2. Apply getCommand method on the above command (`insertTable`) to identify its state expression.

    ```JavaScript
    var insertTableCmd = GC.Spread.Sheets.Designer.getCommand('insertTable');
    insertTableCmd.enableContext = "!AllowInsertTable"; 
    ```
3. Set the above command to commandMap in your project and disable the respective state expression by setting the `enableContext` option.

    ```JavaScript
    config.commandMap = {
        insertTable: insertTableCmd
    }
    ```
4. Initialize the designer instance by passing the `config` parameter for customizable configuration.

    ```JavaScript
    var designer = new GC.Spread.Sheets.Designer.Designer("designerHost", config);
    ```

The below output will be generated:
![image](https://cdn.mescius.io/document-site-files/images/b2223940-43c2-44cf-8eda-f5ab9acd84f0/image.1350f1.png?width=1000)