# Dropdown - Usage

> Usage guide for the ix-dropdown, ix-dropdown-item

# Dropdown - Usage

Dropdown containers allow users to select one option from a list. Selecting one of the items in the dropdown performs the action.

![Overview](https://www.figma.com/design/wEptRgAezDU1z80Cn3eZ0o/iX-Pattern-Illustrations?type=design&node-id=2353-2278&mode=design&t=OVHeXvLZYLkP2CzN-4)

1. Dropdown container
2. Item
3. Header
4. Quick actions
5. Submenu
6. Checked
7. Separator
8. Icon
9. Label

## Options

- **Header:** Add a header for the dropdown container. This allows users to better understand which elements are in the dropdown.
- **Quick actions:** Add a quick action bar. Add 3 to 5 actions/items to the quick actions. We typically use quick actions to access common functions such as cut, copy and paste.
- **Checked:** Mark selected items in the dropdown with a check mark. We typically use check marks when an item can be activated (e.g. for the dropdown "Sort by:" selection: name, modified date, create date).
- **Submenu:** Add a submenu for a multi-level dropdown. We typically use a submenu when there is a long item list and different systematic categorization within the items.
- **Separator:** Add a separator to visually divide items from each other. We normally use a separator to isolate individual elements from a cohesive item list.
- **Icon:** Icons can be displayed to support the label and make the item more easy to discover by the user. The icon should be widely known for representing the action or function among your users.
- **Label:** Set a label for the dropdown item. We typically use short labels including verbs.
- **Trigger:** The trigger defines which element opens the dropdown. A trigger should also be defined for a dropdown submenu. We typically use a button as the trigger element.
- **Anchor:** An anchor defines where the dropdown is placed. When no anchor is defined, the trigger element is used as the anchor.
- **Anchor position:** Set `anchorPosition` to place a dropdown at viewport coordinates, independent of a trigger or anchor. While set, it takes precedence over both for positioning. It doesn't open the dropdown by itself. This is useful, e.g. for a context menu where the position is known when the dropdown is rendered.
- **Point positioning:** Call `showAt(x, y)` to open a dropdown at viewport coordinates, or move it while it is open. While the dropdown is open, this position takes precedence over `anchorPosition`, the anchor and the trigger. It is discarded when the dropdown closes and does not change `anchorPosition`, so the next time the dropdown opens it is positioned by `anchorPosition` again if set, otherwise by the anchor or trigger.
- **Close behavior:** Defines whether a click inside and/or outside the dropdown closes the dropdown. A submenu is always closed together with the parent dropdown. Three Options are possible:
  - Inside: clicking within the dropdown closes the dropdown.
  - Outside: clicking outside the dropdown closes the dropdown.
  - Both: clicking within and outside the dropdown closes the dropdown.
  - False: dropdown will only close if it’s parent gets closed.
- **Placement:** Place a dropdown at the top, bottom, left or right edge as well as at the beginning or end of the trigger/anchor element. The placement may be automatically adjusted in case it cannot be displayed correctly (detailed behavior described in the context section below). We typically use the default (bottom right) placement option to ensure consistency.
- **Date selection:** Use the component [date dropdown](../date-dropdown) to get a date selection in the dropdown.

![Dropdown Examples](https://www.figma.com/design/wEptRgAezDU1z80Cn3eZ0o/iX-Pattern-Illustrations?type=design&node-id=2372-2696&mode=design&t=OVHeXvLZYLkP2CzN-4)

## Behavior in context

- **Text truncation:** The labels of the items and the header only consist of one line. A truncation only occurs if there is not enough space on the screen.
- **Scrollbar:** A dropdown is provided with a scrollbar when the dropdown takes up 50% of the screen.
- **Placement:** By default, the dropdown is positioned relative to its trigger or anchor, and displayed at the bottom right. If there is not enough room, its placement is adjusted automatically. Submenu placement is also determined automatically. When `anchorPosition` or `showAt` is used, the supplied viewport point positions the dropdown instead of the trigger or anchor.
- **Focus:** When a dropdown is opened with `showAt`, or at `anchorPosition` without a trigger, there is no trigger element to keep focus. Focus therefore moves into the dropdown, and returns to the previously focused element when the dropdown closes. Assistive technologies are informed about the active item.
- **Quick actions:** Quick actions only consist of icons, therefore it's important to use icons that are understandable without a label or tooltip. A quick action bar can also be used without additional items in the dropdown.

![Dropdown in Context](https://www.figma.com/design/wEptRgAezDU1z80Cn3eZ0o/iX-Pattern-Illustrations?node-id=2463-3302&t=QaiBJKNOwHMdBuk2-4)

## States

Dropdown items have five states: Default, hover, active, disabled and focused. When a submenu is in an active state, the submenu displays an additional dropdown with selectable options.

![Item States](https://www.figma.com/design/wEptRgAezDU1z80Cn3eZ0o/iX-Pattern-Illustrations?type=design&node-id=2343-42235&mode=design&t=OVHeXvLZYLkP2CzN-4)

## Dos and Don’ts

  
    
      Do structure dropdown items coherently with submenus, quick actions and separators
      Do use dropdowns to showcase related actions
      Do disable items that cannot be used at that moment
    
  
  
    
      Don’t use global navigation options in a dropdown
      Don’t use too many dropdown items - we recommend a maximum of seven
      Don’t insert the [date picker](../date-dropdown) instead)
    
  

## Related

- [Dropdown button](../dropdown-button)
- [Split button](../split-button)
- [Date dropdown](../date-dropdown)
- [Select](../select)
