MithrilUI.Animations (Mithril UI v0.1.2)
View SourcePredefined animation presets for use with Phoenix.LiveView.JS commands.
These animations work with Tailwind CSS transition utilities and are designed
to be used with JS.show/2 and JS.hide/2 transition options.
Usage
import MithrilUI.Animations
JS.show(transition: modal_enter())
JS.hide(transition: modal_leave())Animation Types
- Modal - Scale + fade for dialog overlays
- Dropdown - Fade + slide for menus
- Toast - Slide from edge for notifications
- Drawer - Full slide for side panels
- Fade - Simple opacity transitions
- Backdrop - Overlay fade animations
- Accordion - Expand/collapse for sections
Accessibility
All animations respect the user's prefers-reduced-motion preference when
combined with the provided CSS (see assets/css/mithril_ui/animations.css).
Summary
Functions
Accordion collapse animation.
Accordion expand animation.
Alert enter animation - slide down + fade.
Alert leave animation.
Backdrop fade in animation.
Backdrop fade out animation.
Drawer enter animation - slide from specified side.
Drawer leave animation - slide to specified side.
Dropdown enter animation - fade + slide down.
Dropdown leave animation.
Simple fade in animation.
Simple fade out animation.
Modal enter animation - fade + scale.
Modal leave animation - fade + scale.
Toast enter animation - slide in from right.
Toast leave animation.
Tooltip enter animation - fade + slight scale.
Tooltip leave animation.
Functions
Accordion collapse animation.
Accordion expand animation.
Alert enter animation - slide down + fade.
Alert leave animation.
Backdrop fade in animation.
Backdrop fade out animation.
Drawer enter animation - slide from specified side.
Parameters
side-:leftor:right
Example
JS.show(transition: drawer_enter(:left))
Drawer leave animation - slide to specified side.
Parameters
side-:leftor:right
Dropdown enter animation - fade + slide down.
Dropdown leave animation.
Simple fade in animation.
Simple fade out animation.
Modal enter animation - fade + scale.
Example
<div
id="my-modal"
phx-mounted={JS.show(transition: modal_enter())}
>
Modal content
</div>
Modal leave animation - fade + scale.
Example
JS.hide(transition: modal_leave())
Toast enter animation - slide in from right.
Toast leave animation.
Tooltip enter animation - fade + slight scale.
Tooltip leave animation.