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
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<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
All props accepted by this component, with their type, default value and 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
Content slots exposed by this component.
- #default
- A single child element to be transitioned. The JS hooks read its offsetWidth to animate width from 0 to natural size.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- 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
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
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.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Expand a panel horizontally
Collapsible sidebar
Ecosystem
Family
Components from the same folder that share conventions and often compose together.
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.