# Split button

Source: https://ecosphere.dev/docs/actions/split-button (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

A primary action with a caret for its alternatives — Send, or Schedule send.

`import { EcoSplitButton } from "vue-ecosphere"`

## Send / Schedule send

From the composer: the main half sends now, the caret opens the schedule choices. Pair the caret with a menu and bind v-model:open to it.

Vue (vue-ecosphere):

```vue
<EcoSplitButton
  v-model:open="scheduleOpen"
  icon="send-plane-line"
  label="Send"
  menu-label="Schedule send"
  @click="send"
  @menu="toggleScheduleMenu"
/>
```

React (react-ecosphere):

```tsx
const [scheduleOpen, setScheduleOpen] = useState(false);

<EcoSplitButton
  open={scheduleOpen}
  onOpenChange={setScheduleOpen}
  icon="send-plane-line"
  label="Send"
  menuLabel="Schedule send"
  onClick={send}
  onMenu={toggleScheduleMenu}
/>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | — | Main action text; the default slot overrides it. |
| `icon` | `string` | — | Leading RemixIcon on the main action. |
| `menuLabel` | `string` | — | Required. aria-label and tooltip of the caret. |
| `menuId` | `string` | — | id of the menu the caret controls (aria-controls). |
| `v-model:open` | `boolean` | false | Drives aria-expanded and rotates the chevron. Toggled by the caret. |
| `disabled` | `boolean` | false | Disables both halves. |
| `@click` | `(e: MouseEvent)` | — | The main action was pressed. |
| `@menu` | `(e: MouseEvent)` | — | The caret was pressed; open your menu. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | — | Main action text; children override it. |
| `icon` | `string` | — | Leading RemixIcon on the main action. |
| `menuLabel` | `string` | — | Required. aria-label and tooltip of the caret. |
| `menuId` | `string` | — | id of the menu the caret controls (aria-controls). |
| `open / onOpenChange` | `boolean` | false | Drives aria-expanded and rotates the chevron. Toggled by the caret. |
| `disabled` | `boolean` | false | Disables both halves. |
| `onClick` | `(e: MouseEvent)` | — | The main action was pressed. |
| `onMenu` | `(e: MouseEvent)` | — | The caret was pressed; open your menu. |
