Class: Shadcn::MenubarComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/menubar_component.rb

Overview

Menubar component Matches shadcn/ui Menubar component A visually persistent menu common in desktop applications

Examples:

Basic menubar

<%= render Shadcn::MenubarComponent.new do |menubar| %>
  <% menubar.with_menu do |menu| %>
    <% menu.with_trigger { "File" } %>
    <% menu.with_content do |content| %>
      <% content.with_item(href: "#") { "New Tab" } %>
      <% content.with_item(href: "#") { "New Window" } %>
      <% content.with_separator %>
      <% content.with_item(href: "#") { "Exit" } %>
    <% end %>
  <% end %>
  <% menubar.with_menu do |menu| %>
    <% menu.with_trigger { "Edit" } %>
    <% menu.with_content do |content| %>
      <% content.with_item(href: "#") { "Undo" } %>
      <% content.with_item(href: "#") { "Redo" } %>
    <% end %>
  <% end %>
<% end %>

Constant Summary collapse

BASE_CLASSES =
"flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Method Summary

Methods inherited from BaseComponent

#content, #initialize

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

This class inherits a constructor from Shadcn::BaseComponent