Set dynamic class depending of parameter received

Viewed 310

I'm new using Vuejs and I have a component that I want to set height value only if I send a parameter in props

So, my class is something like this:

 <input
            tag="section"
            class="h-full"
          >

As you can see I use h-full class (tailwind framework) but I want to remove it if prop comes true, so I create a new prop:

props: {
 adjustHeightToContent: {
      type: Boolean,
      default: false,
    }
  },

I want to know how can I set that CSS class to dynamic depending of parameter value

Component usage:

<BaseInput v-if="isModalShown"> </BaseInput>
1 Answers

Use can use this:

:class="adjustHeightToContent ? 'h-auto' : 'h-full'"

Related