# multiline-ternary

Rule `vue/multiline-ternary`. Enforce newlines between operands of ternary expressions in `<template>`

- Source: vue
- Technologies: Vue
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2054 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/multiline-ternary` | no | safe | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/multiline-ternary.html) |

## Code examples

### Incorrect: the rule reports this

```vue
    <div :class="isEnabled ? 'check' : 'stop'" />
  </div>
</template>

<style>
div {
  /* ✓ GOOD */
  color: v-bind('myFlag
    ? foo
    : bar');

  /* ✗ BAD */
  color: v-bind('myFlag ? foo : bar');
}
</style>
```

### Correct: the rule accepts this

```vue
<div :class="isEnabled
  ? 'check'
  : 'stop'" />
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import vue from "eslint-plugin-vue";

export default [
  {
    plugins: { vue },
    rules: {
      "vue/multiline-ternary": "error",
    },
  },
];
```

## Related rules

- [eslint/multiline-ternary](https://lintradar.dev/rules/eslint/multiline-ternary.md): Enforce newlines between operands of ternary expressions
- [vue/max-template-depth](https://lintradar.dev/rules/vue/max-template-depth.md): Enforce maximum depth of template
- [vue/new-line-between-multi-line-property](https://lintradar.dev/rules/vue/new-line-between-multi-line-property.md): Enforce new lines between multi-line properties in Vue components
- [vue/max-lines-per-block](https://lintradar.dev/rules/vue/max-lines-per-block.md): Enforce maximum number of lines in Vue SFC blocks
- [vue/no-bare-strings-in-template](https://lintradar.dev/rules/vue/no-bare-strings-in-template.md): Disallow the use of bare strings in `<template>`
- [vue/max-len](https://lintradar.dev/rules/vue/max-len.md): Enforce a maximum line length in `.vue` files

---

Web page: https://lintradar.dev/rules/vue/multiline-ternary. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
