'Set dynamic class depending of parameter received

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>


Solution 1:[1]

Use can use this:

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Parsa Ghadimkhani