From 5ecd73c5999940b23484530e30c3724b4e3ebb49 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 2 Nov 2021 16:54:17 -0400 Subject: [PATCH] update example --- docs/components/dropdown.md | 106 ++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/docs/components/dropdown.md b/docs/components/dropdown.md index fec7e53e..f84a1198 100644 --- a/docs/components/dropdown.md +++ b/docs/components/dropdown.md @@ -33,6 +33,59 @@ Dropdowns are designed to work well with [menus](/components/menu) to provide a ## Examples +### Getting the Selected Item + +When dropdowns are used with [menus](/components/menu), you can listen for the `sl-select` event to determine which menu item was selected. The menu item element will be exposed in `event.detail.item`. You can set `value` props to make it easier to identify commands. + +```html preview + + + +``` + +Alternatively, you can listen for the `click` event on individual menu items. Note that, using this approach, disabled menu items will still emit a `click` event. + +```html preview + + + +``` + ### Placement The preferred placement of the dropdown can be set with the `placement` attribute. Note that the actual position may vary to ensure the panel remains in the viewport. @@ -121,57 +174,4 @@ Dropdown panels will be clipped if they're inside a container that has `overflow ``` -### Getting the Selected Item - -When dropdowns are used with [menus](/components/menu), you can listen for the `sl-select` event to determine which menu item was selected. The menu item element will be exposed in `event.detail.item`. You can set `value` props to make it easier to identify commands. - -```html preview - - - -``` - -Alternatively, you can listen for the `click` event on individual menu items. Note that, using this approach, disabled menu items will still emit a `click` event. - -```html preview - - - -``` - [component-metadata:sl-dropdown]