---
title: Boolean Prop Type Order Affects Casting Behavior
impact: MEDIUM
impactDescription: Wrong type order causes boolean props to be parsed as empty strings instead of true
type: gotcha
tags: [vue3, props, boolean, type-casting, validation]
---
# Boolean Prop Type Order Affects Casting Behavior
**Impact: MEDIUM** - When a prop accepts multiple types including both `Boolean` and `String`, the order in the type array determines how attribute-only syntax (e.g., ``) is parsed. Incorrect ordering can result in `""` (empty string) instead of `true`.
Vue applies special boolean casting rules, but String appearing before Boolean disables this casting.
## Task Checklist
- [ ] Place `Boolean` before `String` in type arrays when you want boolean casting
- [ ] Test attribute-only syntax (``) to verify expected behavior
- [ ] Consider using only `Boolean` type if the prop is truly boolean
- [ ] Document the expected usage if both String and Boolean are intentional
**Incorrect:**
```vue
```
```vue
```
**Correct:**
```vue
```
```vue
```
## Boolean Casting Rules
| Prop Declaration | Template Usage | Resulting Value |
|-----------------|----------------|-----------------|
| `Boolean` | `` | `true` |
| `Boolean` | `` (absent) | `false` |
| `[Boolean, String]` | `` | `true` |
| `[String, Boolean]` | `` | `""` (empty string) |
| `[Boolean, Number]` | `` | `true` |
| `[Number, Boolean]` | `` | `true` |
Note: The String type is special - it's the only type that overrides Boolean casting when placed first.
## When to Use Multiple Types
```vue
```
## Reference
- [Vue.js Props - Boolean Casting](https://vuejs.org/guide/components/props.html#boolean-casting)