---
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 Heading from "~/components/docs/Heading.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>
  <Heading level={2}>Installation</Heading>
  <Heading level={3}>Barrel</Heading>

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

<Heading level={3}>Granular</Heading>

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

</ComponentSection>

{/* Usage */}

<ComponentSection>
  <Heading level={2}>Usage</Heading>

```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>
  <Heading level={2}>Examples</Heading>

<Heading level={3}>Text Formatting</Heading>
<ComponentExample demo="MenuBarTextFormattingDemo">
  <MenuBarTextFormattingDemo client:visible />
</ComponentExample>

  <Heading level={3}>Without Active State</Heading>
  <ComponentExample demo="MenuBarNoActiveDemo">
    <MenuBarNoActiveDemo client:visible />
  </ComponentExample>
</ComponentSection>

{/* API Reference */}

<ComponentSection>
  <Heading level={2}>API Reference</Heading>
  <PropsTable component="MenuBar" />
</ComponentSection>
