---
title: "MazExpandAnimation"
description: "MazExpandAnimation is a standalone component that allows you to animate the height of a block element"
package: "maz-ui"
url: "https://maz-ui.com/components/maz-expand-animation"
---

# MazExpandAnimation

> MazExpandAnimation is a standalone component that allows you to animate the height of a block element

- Package: `maz-ui`
- Import: `import MazExpandAnimation from 'maz-ui/components/MazExpandAnimation'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-expand-animation

> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)

## Basic usage

```vue
<script lang="ts" setup>
import MazExpandAnimation from 'maz-ui/components/MazExpandAnimation'
import { ref } from 'vue'

const visible = ref(false)
</script>

<template>
  <MazBtn @click="visible = !visible">
    Exec animation
  </MazBtn>

  <MazExpandAnimation v-model="visible">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </MazExpandAnimation>
</template>
```

## Options

- **duration**: `String` - default: `300ms` - Duration of the animation in ms
- **timing-function**: `String` - default: `ease-in-out` - Timing function of the animation
- **lazy**: `Boolean` - default: `false` - Render the content at the first opening only (see Lazy content)

```vue
<script lang="ts" setup>
import MazExpandAnimation from 'maz-ui/components/MazExpandAnimation'
import { ref } from 'vue'

const visible = ref(false)
</script>

<template>
  <MazBtn @click="visible = !visible">
    Exec animation
  </MazBtn>

  <MazExpandAnimation v-model="visible" duration="1000ms" timing-function="linear">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </MazExpandAnimation>
</template>
```

## Lazy content

The content is always rendered, even closed. Add `lazy` to render it at the first opening only: it is then kept mounted, so the closing animation still works. The default stays unchanged.

```vue
<template>
  <MazExpandAnimation v-model="visible" lazy>
    <HeavyContent />
  </MazExpandAnimation>
</template>
```

## MazExpandAnimation API

`import MazExpandAnimation from 'maz-ui/components/MazExpandAnimation'`

### Props

- `duration` (`string`, default: `"300ms"`): Duration of the animation in milliseconds.
- `timing-function` (`string`, default: `"ease-in-out"`): Timing function of the animation.
- `lazy` (`boolean`, default: `false`): Render the content at the first opening only, then keep it mounted (the closing animation still works).
- `model-value` (`boolean`, `v-model`)

### Events

- `@update:modelValue` (payload: `value: boolean | undefined`)

### Slots

- `#default`: Default Slot - Display content
