Dropdown

Expand related actions from a single trigger.

Live preview
Interact with the component to see results here.
View code
HTML
<div style="align-self:center;margin:40px 0">
  <sy-dropdown
    position="bottomLeft"
    trigger="click"
    size="medium"
  ><span slot="title">Project actions</span>
    <sy-menu>
      <sy-menu-item value="edit">Edit</sy-menu-item>
      <sy-menu-item value="copy">Duplicate</sy-menu-item>
      <sy-menu-item value="archive" disabled>Archive</sy-menu-item>
    </sy-menu>
  </sy-dropdown>
</div>

Usage guide

#

Use to collect secondary commands behind a button. Use Select for choosing values in a form.

  1. Build the trigger

    Put the trigger users click in the title slot.

  2. Place the command list

    Build sy-menu and its items in the default slot.

  3. Run the selected command

    Read value from the selected event and perform the corresponding action. Use disabled to prevent execution.

Feature examples

#

Choose a feature from 8 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Borderless

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Disabled

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Position

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Size

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Trigger

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Events · Selected

Interact with the component to see event names and payloads in the live preview below.

View code
HTML
Loading the example.

Usage examples · Compact action menu

Use a small borderless trigger for a compact action menu.

View code
HTML
<div style="align-self:center;margin:40px 0">
  <sy-dropdown
    position="bottomLeft"
    trigger="click"
    size="small"
    borderless
    id="supplement-1"
  ><span slot="title">Project actions</span>
    <sy-menu>
      <sy-menu-item value="edit">Edit</sy-menu-item>
      <sy-menu-item value="copy">Duplicate</sy-menu-item>
      <sy-menu-item value="archive" disabled>Archive</sy-menu-item>
    </sy-menu>
  </sy-dropdown>
</div>

<script type="module">
  const component1 = document.querySelector("#supplement-1");
  Object.assign(component1, {
    "size": "small",
    "borderless": true
  });
</script>

API reference

#

Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.

<sy-dropdown>

Properties

Attribute / PropertyTypeDefaultDescription
booleanfalseHide the default border.
booleanfalseBlock user interaction and keyboard focus.
'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight''bottomLeft'Corner used to align the menu with its trigger.
'small' | 'medium' | 'large''medium'Component size.
'hover' | 'click''click'User action that opens the list or popup.
string''Helper description for the trigger.

Events

EventDetailDescription
CustomEvent<any>Emitted when the user selects an item.

Slots

SlotDescription
Content displayed in the title area.
Component body or child items.