ExpandX
JS-driven horizontal width expand/collapse transition. Animates the element width from 0 to its natural offsetWidth (enter) and back to 0 (leave). Duration 0.5s with cubic-bezier(0.4, 0, 0.2, 1).
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-expand-x> — wraps a single element. JS hooks read offsetWidth to animate width from 0 → natural size on enter ①, and back to 0 on leave ②. overflow: hidden is set during the transition to prevent content overflow.- 1.origam-transition--expand-x-enter-active
- Enter phase. CSS class drives transition-duration (0.5s), timing (cubic-bezier(0.4,0,0.2,1)) and transition-property (width). The JS beforeEnter hook stashes the initial width; enter sets width to 0 then requestAnimationFrame restores offsetWidth.
- 2.origam-transition--expand-x-leave-active
- Leave phase. CSS class drives transition-duration (0.5s), timing and transition-property. The JS leave hook stashes the current width and animates to 0. afterLeave restores the initial style.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- disabledbooleanfalse
- When true, the Vue transition uses :css="false" — JS hooks still run but no CSS classes are applied. Content appears/disappears instantly.
- namestring'origam-transition--expand-x'
- Vue transition name prefix. Drives the CSS class applied on enter/leave. Overridable to use custom CSS keyframes.
- groupboolean
- Vue transition mode. Defaults to 'in-out': the entering element expands first, then the leaving element collapses.
- hideOnLeaveboolean
- leaveAbsoluteboolean
API
Slots
Emplacements de contenu exposés par ce composant.
- #default
- A single child element to be transitioned. The JS hooks read its offsetWidth to animate width from 0 to natural size.
API
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Duration of the enter (expand) animation.
- Easing function for the enter animation.
- CSS property animated on enter.
- Duration of the leave (collapse) animation.
- Easing function for the leave animation.
- CSS property animated on leave.
- Duration of the move animation in group transitions.
- CSS property animated during group moves.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Notes
- Set disabled=true to suppress all animations for users with prefers-reduced-motion: reduce. OrigamDatePickerMonth passes this prop automatically when the media query matches.
- ExpandX is transparent to the accessibility tree — it adds no ARIA roles or attributes. Only the slotted content is visible to screen readers.
- During the transition, overflow: hidden is set on the element to prevent content from showing outside the animated bounds. The original overflow is restored in afterEnter / afterLeave.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Expand a panel horizontally
Collapsible sidebar
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.
Transition
Generic CSS-driven Vue transition wrapper.
ExpandY
Vertical height expand/collapse transition (counterpart to ExpandX).
Fade
Opacity-only enter/leave transition.
SlideX
Horizontal slide + fade transition.
SlideY
Vertical slide + fade transition.
ScaleRotate
Scale + rotate + fade combined transition.