# attributes-order

Rule `vue/attributes-order`. Enforce order of attributes

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

## Linters

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

## Code examples

### Incorrect: the rule reports this

```vue
  <div
    ref="header"
    v-for="item in items"
    v-once
    id="uniqueID"
    v-model="headerData"
    my-prop="prop"
    v-if="!visible"
    is="header"
    @click="functionCall"
    v-text="textContent">
  </div>
</template>
```

```vue
  <MyComponent
    key="x"
    v-model="x"
    v-bind="object">
  </MyComponent>
</template>
```

```vue
    <div
      z-prop="Z"
      a-prop="A">
    </div>

    <div
      @input="bar"
      @change="foo">
    </div>

    <div
      v-on:click="functionCall"
      v-on:[c]="functionCall">
    </div>

    <div
      :z-prop="Z"
      :a-prop="A">
    </div>

    <div
      :class="foo"
      class="bar">
    </div>

</template>
```

### Correct: the rule accepts this

```vue
<div
  is="header"
  v-for="item in items"
  v-if="!visible"
  v-once
  id="uniqueID"
  ref="header"
  v-model="headerData"
  my-prop="prop"
  @click="functionCall"
  v-text="textContent">
</div>
<div
  v-for="item in items"
  v-if="!visible"
  prop-one="prop"
  :prop-two="prop"
  prop-three="prop"
  @click="functionCall"
  v-text="textContent">
</div>
<div
  prop-one="prop"
  :prop-two="prop"
  prop-three="prop">
</div>
```

```vue
<MyComponent
  v-bind="object"
  id="x"
  v-model="x"
  v-bind:foo="x">
</MyComponent>
```

```vue
<div
  a-custom-prop="value"
  :another-custom-prop="value"
  :blue-color="false"
  boolean-prop
  class="foo"
  :class="bar"
  z-prop="Z"
  v-on:[c]="functionCall"
  @change="functionCall"
  v-on:click="functionCall"
  @input="functionCall"
  v-text="textContent">
</div>
```

Examples from the ESLint documentation.

## Enable it

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

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

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Vue recommended](https://lintradar.dev/presets/vue-recommended.md) | ESLint | `eslint-plugin-vue` | 118 | 9.5M | +46.6% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |

## Related rules

- [vue/html-self-closing](https://lintradar.dev/rules/vue/html-self-closing.md): Enforce self-closing style
- [vue/order-in-components](https://lintradar.dev/rules/vue/order-in-components.md): Enforce order of properties in components
- [vue/html-end-tags](https://lintradar.dev/rules/vue/html-end-tags.md): Enforce end tag style
- [vue/first-attribute-linebreak](https://lintradar.dev/rules/vue/first-attribute-linebreak.md): Enforce the location of first attribute
- [vue/v-on-event-hyphenation](https://lintradar.dev/rules/vue/v-on-event-hyphenation.md): Enforce v-on event naming style on custom components in template
- [vue/component-definition-name-casing](https://lintradar.dev/rules/vue/component-definition-name-casing.md): Enforce specific casing for component definition name

---

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