From f6c2007636ccbdfe75746520d3f89cdc257dd6b7 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Fri, 19 Feb 2021 15:53:21 -0800 Subject: [PATCH] feat(dropdown): add direction prop --- COMPONENT_INDEX.md | 1 + docs/src/COMPONENT_API.json | 10 ++++++++++ docs/src/pages/components/Dropdown.svx | 8 ++++++++ src/Dropdown/Dropdown.svelte | 13 ++++++++++--- tests/Dropdown.test.svelte | 1 + types/Dropdown/Dropdown.d.ts | 6 ++++++ 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 35895bcb..97627bb2 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -985,6 +985,7 @@ export interface DropdownItem { | items | let | No | DropdownItem[] | [] | Set the dropdown items | | itemToString | let | No | (item: DropdownItem) => string | (item) => item.text || item.id | Override the display of a dropdown item | | type | let | No | "default" | "inline" | "default" | Specify the type of dropdown | +| direction | let | No | "bottom" | "top" | "bottom" | Specify the direction of the dropdown menu | | size | let | No | "sm" | "lg" | "xl" | -- | Specify the size of the dropdown field | | light | let | No | boolean | false | Set to `true` to enable the light variant | | disabled | let | No | boolean | false | Set to `true` to disable the dropdown | diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 923ae719..ea9ad857 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -2320,6 +2320,16 @@ "constant": false, "reactive": false }, + { + "name": "direction", + "kind": "let", + "description": "Specify the direction of the dropdown menu", + "type": "\"bottom\" | \"top\"", + "value": "\"bottom\"", + "isFunction": false, + "constant": false, + "reactive": false + }, { "name": "size", "kind": "let", diff --git a/docs/src/pages/components/Dropdown.svx b/docs/src/pages/components/Dropdown.svx index 4db48c86..2cc508d1 100644 --- a/docs/src/pages/components/Dropdown.svx +++ b/docs/src/pages/components/Dropdown.svx @@ -33,6 +33,14 @@ Use the `itemToString` prop to format the display of individual items. +### Top direction + +Set `direction` to `"top"` for the dropdown menu to appear above the input. + + + ### Light variant