Skip to content

booleanProp NPM Version

Stability: experimental ⚠️ Experimental feature, use at your risk

Convert <Comp checked /> to <Comp :checked="true" />.

Convert <Comp !checked /> to <Comp :checked="false" />.

FeaturesSupported
Vue 3
Nuxt 3
Vue 2
Volar Plugin

Options

ts
interface Options {  /**  * @default '!'  */  negativePrefix?: string }

Usage

vue
<script setup> import 
Comp
from './Comp.vue'
</script> <template> <
Comp
checked
!
enabled
/>
</template>
vue
<script setup lang="ts"> // Comp.vue 
defineProps
<{
checked
: true
enabled
: false
}>() </script>

Volar Configuration

tsconfig.json
jsonc
{  "vueCompilerOptions": {  "plugins": ["unplugin-vue-macros/volar"],  "vueMacros": {  "booleanProp": true,  },  }, }

Contributors

Changelog