Vue-select: HTML Label

Created on 8 Aug 2017  路  9Comments  路  Source: sagalbot/vue-select

Hi,
Is HTML on labels supported?

example:

[
    {
        "value": "foo",
        "label": "<b>foo</b>"
    }
]

Should output the bold "foo"

Most helpful comment

@nya1 this is coming in v2.3.0.

All 9 comments

No. It will be not bold. It will be escaped.

From the source code:

<a @mousedown.prevent="select(option)"> {{ getOptionLabel(option) }} </a>

This means it will escape whatever you put in the label.

@nya1 this is coming in v2.3.0.

When will v2.3.0 will be released ? Without this feature i can't use your awesome component :(

When will v2.3.0 will be released ? Without this feature i can't use your awesome component :(

Looks like this was dropped?

@sagalbot ?? Any news ?? You released v 2.3.0 and more but still no html label :(

Any updates on this?

is there a way to pass HTML labels?
:get-option-label="getOrderLabel"

getOrderLabel(option) {
return '<span class="red">'+option.status.name+'</span>'
}

this would return escaped html..

For anyone interested, the way to do this would be to use the selected-option slot.

Put this within your <v-select></v-select> component.

<template slot="selected-option" slot-scope="option">
    <span v-html="option.label"></span>
</template>

This will give you your label in html.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabianmieller picture fabianmieller  路  3Comments

gilles6 picture gilles6  路  3Comments

rudykaze picture rudykaze  路  3Comments

NexoraSolutions picture NexoraSolutions  路  3Comments

davidalvarezr picture davidalvarezr  路  3Comments