mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
feat(multi-select): add direction prop
This commit is contained in:
parent
f6c2007636
commit
89a500e523
6 changed files with 36 additions and 1 deletions
|
@ -2156,6 +2156,7 @@ export interface MultiSelectItem {
|
||||||
| itemToString | <code>let</code> | No | <code>(item: MultiSelectItem) => string</code> | <code>(item) => item.text || item.id</code> | Override the display of a multiselect item |
|
| itemToString | <code>let</code> | No | <code>(item: MultiSelectItem) => string</code> | <code>(item) => item.text || item.id</code> | Override the display of a multiselect item |
|
||||||
| size | <code>let</code> | No | <code>"sm" | "lg" | "xl"</code> | -- | Set the size of the combobox |
|
| size | <code>let</code> | No | <code>"sm" | "lg" | "xl"</code> | -- | Set the size of the combobox |
|
||||||
| type | <code>let</code> | No | <code>"default" | "inline"</code> | <code>"default"</code> | Specify the type of multiselect |
|
| type | <code>let</code> | No | <code>"default" | "inline"</code> | <code>"default"</code> | Specify the type of multiselect |
|
||||||
|
| direction | <code>let</code> | No | <code>"bottom" | "top"</code> | <code>"bottom"</code> | Specify the direction of the multiselect dropdown menu |
|
||||||
| selectionFeedback | <code>let</code> | No | <code>"top" | "fixed" | "top-after-reopen"</code> | <code>"top-after-reopen"</code> | Specify the selection feedback after selecting items |
|
| selectionFeedback | <code>let</code> | No | <code>"top" | "fixed" | "top-after-reopen"</code> | <code>"top-after-reopen"</code> | Specify the selection feedback after selecting items |
|
||||||
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the dropdown |
|
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the dropdown |
|
||||||
| filterable | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to filter items |
|
| filterable | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to filter items |
|
||||||
|
|
|
@ -5182,6 +5182,16 @@
|
||||||
"constant": false,
|
"constant": false,
|
||||||
"reactive": false
|
"reactive": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "direction",
|
||||||
|
"kind": "let",
|
||||||
|
"description": "Specify the direction of the multiselect dropdown menu",
|
||||||
|
"type": "\"bottom\" | \"top\"",
|
||||||
|
"value": "\"bottom\"",
|
||||||
|
"isFunction": false,
|
||||||
|
"constant": false,
|
||||||
|
"reactive": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "selectionFeedback",
|
"name": "selectionFeedback",
|
||||||
"kind": "let",
|
"kind": "let",
|
||||||
|
|
|
@ -51,6 +51,16 @@ Use the `itemToString` prop to format the display of individual items.
|
||||||
sortItem="{() => {}}"
|
sortItem="{() => {}}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
### Top direction
|
||||||
|
|
||||||
|
Set `direction` to `"top"` for the dropdown menu to appear above the input.
|
||||||
|
|
||||||
|
<MultiSelect direction="top" titleText="Contact" label="Select contact methods..."
|
||||||
|
items="{[{id: "0", text: "Slack"},
|
||||||
|
{id: "1", text: "Email"},
|
||||||
|
{id: "2", text: "Fax"}]}"
|
||||||
|
/>
|
||||||
|
|
||||||
### Light variant
|
### Light variant
|
||||||
|
|
||||||
<MultiSelect light titleText="Contact" label="Select contact methods..."
|
<MultiSelect light titleText="Contact" label="Select contact methods..."
|
||||||
|
|
|
@ -32,6 +32,12 @@
|
||||||
*/
|
*/
|
||||||
export let type = "default";
|
export let type = "default";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the direction of the multiselect dropdown menu
|
||||||
|
* @type {"bottom" | "top"}
|
||||||
|
*/
|
||||||
|
export let direction = "bottom";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the selection feedback after selecting items
|
* Specify the selection feedback after selecting items
|
||||||
* @type {"top" | "fixed" | "top-after-reopen"}
|
* @type {"top" | "fixed" | "top-after-reopen"}
|
||||||
|
@ -252,7 +258,8 @@
|
||||||
size="{size}"
|
size="{size}"
|
||||||
warn="{warn}"
|
warn="{warn}"
|
||||||
warnText="{warnText}"
|
warnText="{warnText}"
|
||||||
class="bx--multi-select {filterable && 'bx--combo-box'}
|
class="bx--multi-select {direction === 'top' &&
|
||||||
|
'bx--list-box--up'} {filterable && 'bx--combo-box'}
|
||||||
{filterable &&
|
{filterable &&
|
||||||
'bx--multi-select--filterable'}
|
'bx--multi-select--filterable'}
|
||||||
{invalid &&
|
{invalid &&
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
|
direction="top"
|
||||||
titleText="Contact"
|
titleText="Contact"
|
||||||
label="Select contact methods..."
|
label="Select contact methods..."
|
||||||
items="{[
|
items="{[
|
||||||
|
|
6
types/MultiSelect/MultiSelect.d.ts
vendored
6
types/MultiSelect/MultiSelect.d.ts
vendored
|
@ -47,6 +47,12 @@ export interface MultiSelectProps
|
||||||
*/
|
*/
|
||||||
type?: "default" | "inline";
|
type?: "default" | "inline";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the direction of the multiselect dropdown menu
|
||||||
|
* @default "bottom"
|
||||||
|
*/
|
||||||
|
direction?: "bottom" | "top";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the selection feedback after selecting items
|
* Specify the selection feedback after selecting items
|
||||||
* @default "top-after-reopen"
|
* @default "top-after-reopen"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue