Skip to content

Commit ab1c1c1

Browse files
docs(transitions): add guidance on using padding with expand transitions (#22121)
Add guidance on using padding with expand transitions
1 parent 9d835e6 commit ab1c1c1

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<template>
2+
<v-app>
3+
<v-container>
4+
<v-btn class="ma-2" color="primary" @click="expand = !expand">
5+
Expand Transition
6+
</v-btn>
7+
8+
<v-expand-x-transition>
9+
<v-responsive v-show="expand" width="fit-content">
10+
<v-alert
11+
class="text-no-wrap"
12+
text="Smooth transition here"
13+
type="info"
14+
></v-alert>
15+
</v-responsive>
16+
</v-expand-x-transition>
17+
</v-container>
18+
</v-app>
19+
</template>
20+
21+
<script setup>
22+
import { ref } from 'vue'
23+
24+
const expand = ref(false)
25+
</script>
26+
27+
<script>
28+
export default {
29+
data: () => ({
30+
expand: false,
31+
}),
32+
}
33+
</script>

packages/docs/src/pages/en/styles/transitions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ The expand transition is used in Expansion Panels and List Groups. There is also
6060

6161
<ExamplesExample file="transitions/misc-expand-x" />
6262

63+
When using `v-expand-transition` or `v-expand-x-transition`, the transition works by animating an element’s height or width between `0` and its natural size. Because of this, applying **padding directly to the transitioning element** (such as `v-alert`) can cause jittery or uneven animations.
64+
65+
If you need padding, wrap your content in a container element (like a `div` or `v-card`) and apply the transition to that container instead. This ensures the expand transition runs smoothly, since the wrapper div has no conflicting padding or margin.
66+
67+
<ExamplesExample file="transitions/misc-expand-x-padding" />
68+
6369
#### Fab
6470

6571
An example of the fab transition can be found in the `v-speed-dial` component.

0 commit comments

Comments
 (0)