Is it possible to programmatically control the show/hide of drop downs from the ts code of the component (in clarity using Angular2)- https://vmware.github.io/clarity/documentation/dropdowns
Basically I am trying to use the drop down as a toast notification i.e. 2 triggers to show the drop down content 1. On click 2. On an event that happened in code (errors in ajax calls etc)
As Jeremy said above, using a dropdown for a toast or notification is not a recommended Clarity design pattern. However, it is possible to hide/show the dropdown menu with code. See the plunker below for an example that uses the
*clrIfOpen
directive.The
*clrIfOpen
directive isn't documented on the site yet but we are working on updating it to reflect usage in these cases.If you set the open property in your code you can hide/show the
clr-dropdown-menu
https://plnkr.co/edit/ZbXWnyMx0thImLXNTqkw?p=preview
Note: Your question helped identify an issue with using Dropdown menus like this, upon first render the menu will not have the correct position. If this affects you please subscribe to it here for updates.
https://github.com/vmware/clarity/issues/1474