# OverflowMenu

## Overview

Use the overflow menu component when additional options are available to the user but there is a space constraint.

<figure><img src="/files/3vns7Vzim8B6OsGPI6WY" alt=""><figcaption></figcaption></figure>

### Widget API

The `CTextField` widget parameters are identical to the normal `TextField` widget, however, it also has some extra parameters:

{% tabs %}
{% tab title="COverflowMenu" %}

| Property           | Description                                                                                                                                                                                                                                   |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| controller         | <p>An object that is used to control the menu.</p><ul><li><strong>Type:</strong> <code>COverflowMenuController</code></li><li><strong>Default:</strong> required</li></ul>                                                                    |
| items              | <p>A list of <code>COverflowMenuItem</code> to display in a column when the menu is open.</p><ul><li><strong>Type:</strong> <code>List\<COverflowMenuItem></code></li><li><strong>Default:</strong> required</li></ul>                        |
| child              | <p>The child contained by the menu.</p><ul><li><strong>Type:</strong> <code>Widget</code></li><li><strong>Default:</strong> required</li></ul>                                                                                                |
| onOpen             | <p>A method called after the menu is open.</p><ul><li><strong>Type:</strong> <code>VoidCallback?</code></li><li><strong>Default:</strong> optional</li></ul>                                                                                  |
| onClose            | <p>A method called after the menu is closed.</p><ul><li><strong>Type:</strong> <code>VoidCallback?</code></li><li><strong>Default:</strong> optional</li></ul>                                                                                |
| barrierDismissible | <p>Whether you can close the menu by tapping the barrier.</p><ul><li><strong>Type:</strong> <code>bool</code></li><li><strong>Default:</strong> <code>true</code></li></ul>                                                                   |
| menuOffset         | <p>The adjustment in the position applied to the menu.</p><ul><li><strong>Type:</strong> <code>Offset</code></li><li><strong>Default:</strong> <code>Offset.zero</code></li></ul>                                                             |
| size               | <p>The size of this menu. It can be <code>regular</code>, <code>sm</code>, or <code>md</code>.</p><ul><li><strong>Type:</strong> <code>COverflowMenuSize</code></li><li><strong>Default:</strong> <code>COverflowMenuSize.md</code></li></ul> |
| {% endtab %}       |                                                                                                                                                                                                                                               |

{% tab title="COverflowMenuItem" %}

| Property     | Description                                                                                                                                                         |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| child        | <p>The content of the item.</p><ul><li><strong>Type:</strong> <code>Widget</code></li><li><strong>Default:</strong> required</li></ul>                              |
| onTap        | <p>Called when the item is tapped.</p><ul><li><strong>Type:</strong> <code>VoidCallback?</code></li><li><strong>Default:</strong> optional</li></ul>                |
| enable       | <p>Whether the item is enabled or not.</p><ul><li><strong>Type:</strong> <code>bool</code></li><li><strong>Default:</strong> <code>true</code></li></ul>            |
| hasDivider   | <p>Whether this item has a divider.</p><ul><li><strong>Type:</strong> <code>bool</code></li><li><strong>Default:</strong> <code>false</code></li></ul>              |
| isDelete     | <p>To make this menu item a danger ghost button.</p><ul><li><strong>Type:</strong> <code>bool</code></li><li><strong>Default:</strong> <code>false</code></li></ul> |
| {% endtab %} |                                                                                                                                                                     |

{% tab title="COverflowMenuButton" %}

| Property           | Description                                                                                                                                                                                                                                   |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| icon               | <p>The icon of the button.</p><ul><li><strong>Type:</strong> <code>Widget</code></li><li><strong>Default:</strong> required</li></ul>                                                                                                         |
| items              | <p>A list of <code>COverflowMenuItem</code> to display in a column when the menu is open.</p><ul><li><strong>Type:</strong> <code>List\<COverflowMenuItem></code></li><li><strong>Default:</strong> required</li></ul>                        |
| enable             | <p>Whether the button is enabled or not.</p><ul><li><strong>Type:</strong> <code>bool</code></li><li><strong>Default:</strong> <code>true</code></li></ul>                                                                                    |
| barrierDismissible | <p>Whether you can close the menu by tapping the barrier.</p><ul><li><strong>Type:</strong> <code>bool</code></li><li><strong>Default:</strong> <code>true</code></li></ul>                                                                   |
| onClose            | <p>A method called after the menu is closed.</p><ul><li><strong>Type:</strong> <code>VoidCallback?</code></li><li><strong>Default:</strong> optional</li></ul>                                                                                |
| onOpen             | <p>A method called after the menu is open.</p><ul><li><strong>Type:</strong> <code>VoidCallback?</code></li><li><strong>Default:</strong> optional</li></ul>                                                                                  |
| menuOffset         | <p>The adjustment in the position applied to the menu.</p><ul><li><strong>Type:</strong> <code>Offset</code></li><li><strong>Default:</strong> <code>Offset.zero</code></li></ul>                                                             |
| size               | <p>The size of this menu. It can be <code>regular</code>, <code>sm</code>, or <code>md</code>.</p><ul><li><strong>Type:</strong> <code>COverflowMenuSize</code></li><li><strong>Default:</strong> <code>COverflowMenuSize.md</code></li></ul> |
| {% endtab %}       |                                                                                                                                                                                                                                               |
| {% endtabs %}      |                                                                                                                                                                                                                                               |

### Example

```dart
COverflowMenu(
    controller: controller,
    child: CButton(
        label: 'Menu Button',
        onTap: () {
            controller.open()
        },
    ),
    items: [
        COverflowMenuItem(
            child: CText(data:'hello'),
            onTap: (){ }
        ),
        COverflowMenuItem(
            isDelete: true,
            child: CText(data:'hello'),
            onTap: (){ }
        ),
    ],
);

// -----

COverflowMenuButton(
    icon: Icon(CIcons.add),
    items: [
        COverflowMenuItem(
            child: CText(data:'hello'),
            onTap: (){ }
        ),
        COverflowMenuItem(
            isDelete: true,
            child: CText(data:'hello'),
            onTap: (){ }
        ),
    ],
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nour-eldin-shobier.gitbook.io/carbon-flutter/widgets/todo-overflow-menu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
