Search code examples
javascriptvue.jsvuejs2buefy

Change default behavior in TagInput element of Buefy library (Vue.js)?


In my Vue.js (version 2.5.22) application I use UI components from Buefy library. I use taginput element. If I have limit of 5 tags as in example below, borders dissapear when input has 5 tags.

QUESTION: Is it possible to change this behavior? I want to show borders anyway.

<b-field label="Limited to 10 characters and 5 tags">
    <b-taginput maxtags="5":value="['Red', 'Green', 'Blue', 'White']">
    </b-taginput>
</b-field>

Solution

  • Well, in my case I use such style:

    <b-field class="always-show" label="Limited to 10 characters and 5 tags">
        <b-taginput maxtags="5" :value="['Red', 'Green', 'Blue', 'White']">
        </b-taginput>
    </b-field>
    

    CSS:

    .always-show .taginput-container {
        align-items: center;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        height: auto;
        cursor: text;
        border-color: #dbdbdb;
        color: #363636;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        clear: both;
        font-size: 1rem;
        position: relative;
        text-align: left;
        border-radius: 4px;
        -webkit-box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1);
        background-color: #fff;
        box-shadow: inset 0 1px 2px hsla(0,0%,4%,.1);
        padding: calc(.375em - 1px) calc(.625em - 1px);
        line-height: 1.5;
      }