---
layout: ~/layouts/MdxDocLayout.astro
title: "MenuBar"
description: "A horizontal menu bar with icon buttons, commonly used for text editors or toolbars."
sourceFile: "components/menubar"
---

import ComponentExample from "~/components/docs/ComponentExample.astro";
import ComponentSection from "~/components/docs/ComponentSection.astro";
import PropsTable from "~/components/docs/PropsTable.astro";
import {
  MenuBarBasicDemo,
  MenuBarTextFormattingDemo,
  MenuBarNoActiveDemo,
} from "~/components/demos/MenuBarDemo";

{/* Hero Demo */}

<ComponentSection>
  <ComponentExample demo="MenuBarBasicDemo">
    <MenuBarBasicDemo client:visible />
  </ComponentExample>
</ComponentSection>

{/* Installation */}

<ComponentSection>

## Installation

### Barrel

```tsx
import { MenuBar } from "@cloudflare/kumo";
```

### Granular

```tsx
import { MenuBar } from "@cloudflare/kumo/components/menubar";
```

</ComponentSection>

{/* Usage */}

<ComponentSection>

## Usage

```tsx
import { MenuBar } from "@cloudflare/kumo";
import { TextBolderIcon } from "@phosphor-icons/react";

export default function Example() {
  return (
    <MenuBar
      options={[
        {
          icon: <TextBolderIcon />,
          id: "bold",
          tooltip: "Bold",
          onClick: () => console.log("Bold clicked"),
        },
      ]}
    />
  );
}
```

</ComponentSection>

{/* Examples */}

<ComponentSection>

## Examples

### Text Formatting

<ComponentExample demo="MenuBarTextFormattingDemo">
  <MenuBarTextFormattingDemo client:visible />
</ComponentExample>

### Without Active State

  <ComponentExample demo="MenuBarNoActiveDemo">
    <MenuBarNoActiveDemo client:visible />
  </ComponentExample>
</ComponentSection>

{/* API Reference */}

<ComponentSection>

## API Reference

  <PropsTable component="MenuBar" />
</ComponentSection>
