Dropdown

Easily drop your things down.

Example

lorem
lorem
lorem
Header 1Header 2Header 3

Props

    đŸ•šī¸ standard props
    items
    Item[]
    List of items to be displayed in the autocomplete menu.
    []
    values
    Item[]
    List of selected items.
    $bindable([])
    multiple
    boolean
    If true, multiple items can be selected.
    false
    lang
    'it' | 'en'
    Language of the autocomplete placeholder text.
    'en'
    searchText
    string
    The search text entered in the input field.
    $bindable()
    maxVisibleChips
    number
    Maximum number of chips to display.
    undefined
    placeholder
    string
    Placeholder text for the input field.
    lang === 'en' ? 'Select' : 'Seleziona'
    clearable
    boolean
    If true, a clear button is displayed to clear the selected items.
    true
    mandatory
    boolean
    If true, the field is mandatory to select.
    true
    icon
    string
    The name of the icon to display in the label.
    undefined
    menuOpened
    boolean
    If true, the autocomplete menu is open.
    $bindable(false)
    openingId
    string
    The unique identifier for the autocomplete menu.
    $bindable('autocomplete-menu')
    width
    string
    Width of the autocomplete input field.
    undefined
    height
    string
    Height of the autocomplete input field.
    undefined
    minWidth
    string
    Minimum width of the autocomplete input field.
    undefined
    menuWidth
    string
    Width of the autocomplete menu.
    width
    mobileDrawer
    boolean
    If true, the menu is displayed as a mobile drawer.
    false
    disabled
    boolean
    If true, the autocomplete is disabled.
    false
    🎨 style props
    No data available

Slots

    itemLabelSnippet
    Renders the label of an item.
    Default content:
    {item.label}
    Available variables:
    NameTypeDescription
    itemItemDataThe item to render the label for.
    labelSnippet
    Snippet for customizing the label of the button element in the autocomplete.
    Default content:
    
    <div class="label">
      {#if !!icon}
        <Icon name={icon}></Icon>
      {/if}
      {#if values.length == 0}
        <div class="space-between">
          <div>{placeholder}</div>
          <Icon name="mdi-chevron-down"></Icon>
        </div>
      {:else}
        <div class="space-between">
          <div>{generatedLabel}</div>
          {#if clearable}
            <Icon
              name="mdi-close"
              onclick={handleCloseClick}
            ></Icon>
          {/if}
        </div>
      {/if}
    </div>
          
    Available variables:
    NameTypeDescription
    valuesItem[]The selected items.
    itemsItem[]The list of available items.
    searchTextstringThe current search text.
    generatedLabelstringThe generated label based on selected items.
    placeholderstringThe placeholder text for the input.
    clearablebooleanIf true, a clear button is displayed.
    handleCloseClickfunctionFunction triggered when the clear button is clicked.

Events

    onchange
    Triggered when the selected items change.
    AttributeTypeDescription
    unselectItem | undefinedThe item that was unselected.
    selectItem | undefinedThe item that was selected.
    selectionItem[]The list of currently selected items.