<p>Dropdowns can be created using the markup below. You can use a <code><button></code> or an <code><a></code> as a trigger. Dropdown indicators (i.e. carets) are added for you. Menu items are simply <code><a></code> elements. Dividers are simply <code><hr></code> elements.</p>
<p>Note the class names used for the main container, the trigger, and the menu. Additionally, menu items can be disabled by adding the <code>disabled</code> class. Menu items can also be given a checked state using the <code>checked</code> class.</p>
<p>To disable a dropdown entirely, add the <code>disabled</code> property to the dropdown trigger if it’s a button. If it’s a link, add the <code>disabled</code> class instead. When a dropdown is activated, it will receive the <code>active</code> class and the menu will show.</p>
<p>Use the <code>dropdown-top</code> and <code>dropdown-left</code> modifiers to change the positioning of the menu. You can combine these modifiers as needed.</p>
<p>Dropdowns require <code>shoelace.js</code> to make them interactive. You don’t need to initialize them. Simply include the script and everything “just works.”</p>
<p>There is no JavaScript API. Shoelace’s philosophy believes that custom components should act like native components as much as possible. You can, however, listen for various events:</p>
<ul>
<li><code>show</code>– Fires when a dropdown is shown.</li>
<li><code>hide</code>– Fires when a dropdown is hidden.</li>
<li><code>select</code>– Fires when a dropdown menu item is selected. The second callback argument is a reference to the respective menu item.</li>
</ul>
<p>This example will log all three events for a dropdown with an id of <code>my-dropdown</code>.</p>
<aclass="github-button"href="https://github.com/claviska/shoelace-css/fork"data-size="large"aria-label="Fork claviska/shoelace-css on GitHub">Fork</a>
<aclass="github-button"href="https://github.com/claviska/shoelace-css/releases"data-icon="octicon-cloud-download"data-size="large"aria-label="Download claviska/shoelace-css on GitHub">Download</a>
<aclass="github-button"href="https://github.com/claviska/shoelace-css/issues"data-icon="octicon-issue-opened"data-size="large"aria-label="Issue claviska/shoelace-css on GitHub">Report a Bug</a>
<aclass="github-button"href="https://github.com/claviska/shoelace-css"data-icon="octicon-star"data-size="large"data-show-count="true"aria-label="Star claviska/shoelace-css on GitHub">Star</a>