Selector
bp-dropdown

Inputs

Dropdown inputs
InputTypeDescriptionNotes
triggerTextstringThe text used in the dropdown trigger button.
triggerClassesstringThe classes used on the dropdown trigger button.
menuClassesstringThe classes used on the dropdown menu.Often used to set menu alignment, e.g. "dropdown-menu-right"
hasCaretbooleanDetermines if the dropdown trigger has the caret.

Default is "true".

When "true", the dropdown trigger has the caret.

dropDirectionstringThe direction in which the menu should open.

Expects either "up", "down", "left", or "right".

Default is "down".

iconTriggerstringThe font awesome icon class used to create an icon trigger.When using iconTrigger, triggerText is visually hidden and used for screen readers.
dropdownItemsobject[]List of properties for creating the dropdown items.
bpIDstringThe value for the dropdown's id attribute.

Ids must only be used once per page.

Ids should be camelCase, e.g.: #myId.

See identifiers.

Dropdown Items

The dropdown item will render either an anchor or a button depending on the properties. If either an href or bpRouterLink is provided, the action will be an anchor. If neither are provided, the action will be a button.

Headings, dividers and plain text can also be added by providing the either heading, isDivider, or plainText key:value pairs. Items render in the same order as in the dropdown items array.

Dropdown item properties
InputTypeDescriptionNotes
textstringThe text used in the dropdown item.
ariaLabelstringThe text used as the aria label of the dropdown item.
actionstringA string to be emitted on click of the dropdown item.Item can only have one of the following: bpRouterLink, href, or action.
hrefstringThe value for the dropdown item's href attribute.Item can only have one of the following: bpRouterLink, href, or action.
bpRouterLinkstringThe value for the dropdown item's routerLink attribute.Item can only have one of the following: bpRouterLink, href, or action.
targetstringThe target for the link.For example, "_blank" opens in a new tab.
isDisabledbooleanDetermines if the dropdown item is disabled or enabled.

Default is "false".

When "true" the dropdown item is disabled.

isDestructivebooleanDetermines if the dropdown item triggers a destructive action.

Default is "false".

When "true" the dropdown item is destructive.

isActivebooleanDetermines if the dropdown item is active. This is used within the primary navigation for marking the active route.

Default is "false".

When "true" the dropdown item is active.

langstringSpecifies the value of the lang attribute on the dropdown item. This is primarily used in the language dropdown.
iconLeftstringThe Font Awesome icon class for an icon on the left of the dropdown item.For example, "fa-external-link-alt" for an external link icon.
iconRightstringThe Font Awesome icon class for an icon on the right of the dropdown item.For example, "fa-chevron-left" for a left facing chevron icon i.e. back link.
headingstringAdds a heading item to the dropdown where the value is the heading text.Should be the only property in the object aside from bpID.
plainTextstringAdds a plain text item to the dropdown where the value is the text.Should be the only property in the object aside from bpID.
isDividerbooleanAdds a divider to the dropdown.Should be the only property in the object aside from bpID.
bpIDstringThe value of the dropdown items id.

Outputs

Dropdown outputs
OutputDescription
clickEmits an event on click of the dropdown item, if it is a button. It will emit the string provided in that item's action property.

Code

Dropdowns should be wrapped in a col-auto grid column.

<div class="col-auto">
  <bp-dropdown
    triggerText="Primary Dropdown"
    triggerClasses="btn-primary"
    dropDirection="up"
    [dropdownItems]="exampleItems"
  ></bp-dropdown>
</div>

Identifiers

Identifiers
IDDescription
bpIDThe unique identifier for the dropdown component.
bpID + 'DropdownToggle'The unique identifier for the dropdown toggle.
bpID + 'Item' + #The unique identifier for the dropdown items. This can be overridden by providing a bpID to individual items object.