diff --git a/content/developer/reference/frontend/owl_components.rst b/content/developer/reference/frontend/owl_components.rst index 865215cf6..47c78fc76 100644 --- a/content/developer/reference/frontend/owl_components.rst +++ b/content/developer/reference/frontend/owl_components.rst @@ -420,271 +420,277 @@ Location Description ~~~~~~~~~~~ -Dropdowns are surprisingly complicated components. They need to provide many -features such as: +The Dropdown lets you show a menu with a list of items when a toggle is +clicked on. They can be combined with DropdownItems to invoke callbacks +and close the menu when items are selected. + +Dropdowns are surprisingly complicated components, the list of features they +provide is as follow: - Toggle the item list on click -- Direct siblings dropdowns: when one is open, toggle others on hover - Close on outside click +- Call a function when items are selected - Optionally close the item list when an item is selected -- Call a function when the item is selected -- Support sub dropdowns, up to any level - SIY: style it yourself +- Support sub dropdowns, up to any level - Configurable hotkey to open/close a dropdown or select a dropdown item - Keyboard navigation (arrows, tab, shift+tab, home, end, enter and escape) - Reposition itself whenever the page scrolls or is resized - Smartly chose the direction it should open (right-to-left direction is automatically handled). - -To solve these issues once and for all, the Odoo framework provides a set of two -components: a `Dropdown` component (the actual dropdown), and `DropdownItem`, -for each element in the item list. - -.. code-block:: xml - - - - - Click me to toggle the dropdown menu ! - - - Menu Item 1 - Menu Item 2 - - -Props -~~~~~ - -A `` component is simply a ` +- Direct siblings dropdowns: when one is open, toggle others on hover To properly use a `` component, you need to populate two `OWL slots `_ : - -- `toggler` slot: it contains the *toggler* elements of your dropdown and is - rendered inside the dropdown `button` (unless the `toggler` prop is set to `parent`), -- `default` slot: it contains the *elements* of the dropdown menu itself and is - rendered inside the `