--- url: /reference/items/Transition/js-api.md --- # JS API ## Options ### `enterFrom` * Type: `string` * Default: `''` Defines the classes that describe the initial state of the enter transition. ```html {2}
...
``` ### `enterActive` * Type: `string` * Default: `''` Defines the classes that describe the transitioning state of the enter transition. ```html {2}
...
``` ### `enterTo` * Type: `string` * Default: `''` Defines the classes that describe the end state of the enter transition. ```html {2}
...
``` ### `enterKeep` * Type: `boolean` * Default: `false` Configures whether or not the `enterTo` classes should be kept on the target element at the end of the enter transition. ```html {2}
...
``` ### `leaveFrom` * Type: `string` * Default: `''` Defines the classes that describe the initial state of the leave transition. ```html {2}
...
``` ### `leaveActive` * Type: `string` * Default: `''` Defines the classes that describe the transitioning state of the leave transition. ```html {2}
...
``` ### `leaveTo` * Type: `string` * Default: `''` Defines the classes that describe the end state of the leave transition. ```html {2}
...
``` ### `leaveKeep` * Type: `boolean` * Default: `false` Configures whether or not the `leaveTo` classes should be kept on the target element at the end of the leave transition. ```html {2}
...
``` ### `group` * Type: `string` * Default: `''` Defines a group to sync `enter` and `leave` transition between multiple instances. ```html {2,7}
...
...
``` ## Properties ### `target` * Type: `HTMLElement` A getter returning the target element for the transition. Defaults to the components root element `this.$el`. ### `state` * Type: `'entering' | 'leaving' | null` * Default: `null` The current state of the transition. Will be `'entering'` when an enter transition is in progress, `'leaving'` when a leave transition is in progress, or `null` when no transition is active. ## Methods ### `enter` * Returns `Promise` Trigger the enter transition. ### `leave` * Returns `Promise` Trigger the leave transition. ### `toggle` * Signature: `toggle(target?: HTMLElement | HTMLElement[]): Promise` * Returns `Promise` Toggle between enter and leave transitions. If the component is currently leaving (or has never transitioned), it will enter. If it's currently entering, it will leave. ```js const transition = new Transition(el); await transition.toggle(); // Triggers enter await transition.toggle(); // Triggers leave await transition.toggle(); // Triggers enter again ``` ## Events ### `transition-toggle` Emitted when the toggle method is called. ### `transition-enter` Emitted when the enter transition is triggered. ### `transition-enter-start` Emitted at the start of the enter transition, before the transition classes are applied. ### `transition-enter-end` Emitted when the enter transition completes. ### `transition-leave` Emitted when the leave transition is triggered. ### `transition-leave-start` Emitted at the start of the leave transition, before the transition classes are applied. ### `transition-leave-end` Emitted when the leave transition completes.