Select ​

Cuando haya muchas opciones, utilice un menú desplegable para mostrar y seleccionar las que desee.

TIP

After version 2.5.0, the default width of el-select changed to 100%. When used in a inline form, the width will collapse. In order to display the width properly, you need to give el-select a specific width (eg: Example) .

Uso básico ​

v-model es el valor de el-option que actualmente está seleccionado.

Select

Options attribute 2.10.5 ​

Shortcut from basic el-option usage. You can customize the alias of the options through the props attribute.

Select

Opción deshabilitada ​

Establezca el valor de disabled en el-option a true para deshabilitar esa opción.

Select

Deshabilitar el select ​

Desactivar todo el componente.

Ajuste disabled de el-select para desactivarlo.

Select

Clearable ​

Puede limpiar el Select con un icono.

Set clearable attribute for el-select and a clear icon will appear.

Select

Sizes ​

Add size attribute to change the size of Select. In addition to the default size, there are two other options: large, small.

Select
Select
Select

Selección múltiple básica ​

Selección múltiple utiliza etiquetas para mostrar las opciones seleccionadas.

Asigne el atributo multiple a el-select para activar la selección múltiple. En este caso, el valor de v-model será un array de opciones seleccionadas. Por defecto, las opciones seleccionadas se mostrarán como etiquetas. Puede colapsar a un texto usando el atributo collapse-tags. Puede comprobarlos cuando el ratón pasa el cursor sobre el texto usando el atributo collapse-tags-tooltip.

default

Select

use collapse-tags

Select

use collapse-tags-tooltip

Select

use max-collapse-tags

Select

Plantilla personalizada ​

Puede personalizar plantillas HTML para opciones.

Insertar plantillas HTML personalizadas en el slot de el-option.

Select

Header of the dropdown 2.4.3 ​

You can customize the header of the dropdown.

Use slot to customize the content.

Select

You can customize the footer of the dropdown.

Use slot to customize the content.

Select

Agrupando ​

Mostrar opciones en grupos.

Use el-option-group para agrupar las opciones, y su atributo label significa el nombre del grupo.

Select

Filtrado de opciones ​

Puede filtrar las opciones que desee.

Añadiendo filterable a el-select se habilita el filtro. Por defecto, Select encontrará todas las opciones cuyo atributo label contiene el valor de entrada. Si prefiere otras estrategias de filtrado, puede pasar el filter-method. filter-method es una funcion que se llama cuando el valor de entrada cambia, y su parámetro es el valor de entrada actual.

Select

Búsqueda remota ​

Introduzca palabras clave y busque los datos en el servidor.

Establezca el valor de filterable y remote con true para habilitar la búsqueda remota, y deberá pasar el remote-method. remote-method es una función que se llama cuando el valor de entrada cambia, y su parámetro es el valor de entrada actual. Tenga en cuenta que si el-option se presenta con la directiva v-for, debe agregar el atributo key para el-option. Su valor debe ser único, como item.value en el siguiente ejemplo.

default

Please enter a keyword

use remote-show-suffix

Please enter a keyword

Crear nuevos items ​

Crear y seleccionar nuevos elementos que no están incluidos en las opciones de selección

usando el atributo allow-create, los usuarios pueden crear nuevos elementos escribiendo en un input. Tenga en cuenta que para que allow-create funcione, filterable debe ser true. Este ejemplo también demuestra default-first-option. Cuando este atributo se establece en true, puede seleccionar la primera opción en la lista de opciones actual pulsando enter sin tener que navegar con teclas de ratón o flecha.

Choose tags for your article

Usar el atributo value-key ​

Si el valor de vinculación de Select es un objeto, asegúrese de asignar value-key como su nombre único de clave de identidad.

Usando el atributo value-key, los datos con etiquetas duplicadas pueden ser manejados correctamente. El valor de la propiedad label está duplicado, pero la opción puede ser identificada a través del id.

Select

selected option's description: no select

Custom Tag 2.5.0 ​

You can customize tags.

Insert customized tags into the slot of el-select. collapse-tags, collapse-tags-tooltip, max-collapse-tags will not work.

Custom Loading 2.5.2 ​

Override loading content.

loading icon1

Please enter a keyword

loading icon2

Please enter a keyword

Empty Values 2.7.0 ​

If you want to support empty string, please set empty-values to [null, undefined].

If you want to change the clear value to null, please set value-on-clear to null.

Custom Label 2.7.4 ​

You can customize label.

: Option1

Select API ​

Select Attributes ​

NombreDescripciónTipoDefault
model-value / v-modelvalor vinculadostring / number / boolean / object / array—
multiplesi multiple-select esta activobooleanfalse
options 2.10.5data of the options, the key of value and label and disabled can be customize by propsarray—
props 2.10.5configuration optionsobject—
disabledsi Select esta deshabilitadobooleanfalse
value-keysi se colapsan los tags a un texto cuando multiple es true.stringvalue
sizetamaño del inputenum—
clearablesi el select puede ser limpiadobooleanfalse
collapse-tagssi contraer etiquetas a un texto con la selección múltiplebooleanfalse
collapse-tags-tooltip 2.3.0si se muestran todas las etiquetas seleccionadas al pasar el ratón sobre el texto de las etiquetas colapsadas. Para usar esto, collapse-tags debe ser truebooleanfalse
tag-tooltip 2.13.3configuration object for the collapse-tags tooltip. To use this, collapse-tags and collapse-tags-tooltip must be trueobject{}
multiple-limitmáximo número de opciones que el usuario puede seleccionar cuando multiple es true. Sin límite cuando se fija a 0number0
idnative input id inputstring—
nameel atributo name del input seleccionadostring—
effecttooltip theme, built-in theme: dark / lightenum / stringlight
autocompleteel atributo autocomplete del input seleccionadostringoff
placeholderplaceholder, default is 'Select'string—
filterablesi Select es filtrablebooleanfalse
allow-createsi está permitido crear nuevos ítems. To use this, filterable must be truebooleanfalse
filter-methodcustom filter method, the first parameter is the current input value. Para usar esto, filterable debe ser true.Function—
remotesi las opciones se traerán desde el servidorbooleanfalse
debounce 2.11.7debounce delay during remote search, in millisecondsnumber300
remote-methodfunction that gets called when the input value changes. Its parameter is the current input value. To use this, filterable must be trueFunction—
remote-show-suffixen el método de búsqueda remota mostrar icono del sufijobooleanfalse
loadingsi Select está cargando datos del servidorbooleanfalse
loading-textdisplayed text while loading data from server, default is 'Loading'string—
no-match-textdisplayed text when no data matches the filtering query, you can also use slot empty, default is 'No matching data'string—
no-data-textdisplayed text when there is no options, you can also use slot empty, default is 'No data'string—
popper-classcustom class name for Select's dropdown and tags' tooltipstring''
popper-style 2.11.0custom style for Select's dropdown and tags' tooltipstring / object—
reserve-keywordwhen multiple and filterable is true, whether to reserve current keyword after selecting an optionbooleantrue
default-first-optionseleccione la primera opción de coincidencia al introducir la clave. Usar con filterable o remotebooleanfalse
teleportedwhether select dropdown is teleported, if true it will be teleported to where append-to setsbooleantrue
append-to 2.8.4which element the select dropdown appends toCSSSelector / HTMLElement—
persistentwhen select dropdown is inactive and persistent is false, select dropdown will be destroyedbooleantrue
automatic-dropdownfor non-filterable Select, this prop decides if the option menu pops up when the input is focusedbooleanfalse
clear-iconcustom clear icon componentstring / objectCircleClose
fit-input-widthwhether the width of the dropdown is the same as the inputbooleanfalse
suffix-iconcustom suffix icon componentstring / objectArrowDown
tag-typetag typeenuminfo
tag-effect 2.7.7tag effectenumlight
validate-eventwhether to trigger form validationbooleantrue
offset 2.8.8offset of the dropdownnumber12
show-arrow 2.8.8whether the dropdown has an arrowbooleantrue
placement 2.2.17position of dropdownenumbottom-start
fallback-placements 2.5.6list of possible positions for dropdown popper.jsarray['bottom-start', 'top-start', 'right', 'left']
max-collapse-tags 2.3.0the max tags number to be shown. To use this, collapse-tags must be truenumber1
popper-optionspopper.js parametersobjectrefer to popper.js doc{}
aria-label a11ysame as aria-label in native inputstring—
empty-values 2.7.0empty values of component, see config-providerarray—
value-on-clear 2.7.0clear return value, see config-providerstring / number / boolean / Function—
suffix-transition deprecatedanimation when dropdown appears/disappears iconbooleantrue
tabindex 2.9.0tabindex for inputstring / number—

WARNING

suffix-transition has been deprecated, and will be removed in 2.4.0, please use override style scheme.

props ​

nameDescripciónTypeDefault
valueespecifica qué clave del objeto del nodo se utiliza como valuestringvalue
labelespecifica qué clave del objeto del nodo se utiliza como labelstringlabel
options 2.11.0especifica qué clave del nodo se utiliza como nodo hijostringoptions
disabledespecifica qué clave del nodo se utiliza para verificar si el nodo está deshabilitado o nostringdisabled

tag-tooltip 2.13.3 ​

Fallback Mechanism

Properties in tag-tooltip follow this priority order:

  1. Explicitly defined fields within the tag-tooltip object.
  2. Shared props inherited from el-select (e.g. effect, popper-class, popper-style, teleported, append-to, popper-options).
  3. Default values of the underlying el-tooltip component. This allows you to override specific tooltip behaviors for tags while maintaining consistency with the Select dropdown by default.

Custom Container Positioning

When appending the Tooltip to a custom container (via the append-to attribute), the container should be configured with position: relative or position: absolute to ensure accurate positioning. Additionally, you can apply overflow: hidden to the container if you need to prevent the Tooltip from overflowing its boundaries.

AtributosDescripciónTipoPor defecto
append-toa qué elemento se agrega el CONTENT del tooltipCSSSelector / HTMLElement—
placementposición del Tooltipenumbottom
fallback-placementslist of possible positions for Tooltip popper.jsarray['bottom', 'top', 'right', 'left']
effectTema del tooltip, temas integrados: dark / lightenum / string—
popper-classnombre de clase personalizada para el popper del Tooltipstring—
popper-stylecustom style for Tooltip's popperstring / object—
transitionnombre de animaciónstring—
teleportedsi el contenido del tooltip es teletransportado, si es true será teletransportado a donde establezca append-toboolean—
popper-optionsparámetros popper.jsobjectrefer to popper.js doc—
show-afterretraso de la aparición, en milisegundosnumber—
hide-afterretraso de la desaparición, en milisegundosnumber—
auto-closetiempo de espera en milisegundos para ocultar el tooltip de forma automáticanumber—
offsetoffset del Tooltipnumber—

Select Events ​

NombreDescripciónType
changese dispara cuando el valor del select cambiaFunction
visible-changese dispara cuando el menú desplegable aparece o desapareceFunction
remove-tagse dispara cuando un tag es removido en modo múltipleFunction
clearse dispara cuando el icono se clickea en un Select limpiableFunction
blurse dispara cuando el input pierde el focoFunction
focusse dispara cuando el input obtiene el focoFunction
popup-scroll 2.9.4triggers when dropdown scrollsFunction
end-reached 2.14.0triggers when dropdown scroll reaches an endFunction

Select Slots ​

Nombre del slotDescripciónSubtags
defaultoption component listOption Group / Option
header 2.4.3content at the top of the dropdown—
footer 2.4.3content at the bottom of the dropdown—
prefixcontenido prefix de un Select—
emptyLista sin opciones—
tag 2.5.0content as Select tag, subTags data, selectDisabled and deleteTag introduced in 2.10.3object
loading 2.5.2content as Select loading—
label 2.7.4content as Select label. index introduced in 2.11.2object

Select Exposes ​

NombreDescriptionTipo
focusfocus the Input componentFunction
blurblur the Input component, and hide the dropdownFunction
selectedLabel 2.8.5get the currently selected labelobject

Option Group API ​

Option Group Attributes ​

NameDescripciónTipoPor defecto
labelname of the groupstring—
disabledwhether to disable all options in this groupbooleanfalse

Option Group Slots ​

NombreDescripciónSubtags
defaultcustomize default contentOption

Option API ​

Option Attributes ​

NombreDescripciónTipoPor defecto
valuevalue of optionstring / number / boolean / object—
labellabel of option, same as value if omittedstring / number—
disabledwhether option is disabledbooleanfalse

Option Slots ​

NameDescripción
defaultcustomize default content

Fuente ​

Componentes • Style • Documentación

Contribuidores ​