Skip to content
Native Animation
Morphing Action Button animation preview

This preview uses fictional demo content. See the props below for the customization options available in this component.

npx nativeanimation add morphing-action-button
Button

Morphing Action Button

React Native Morphing Button to Card

An action button that expands into a card as the screen recedes, with configurable card content, background content, button color, and card width.

$9 for this animation

Add to your project

Copy the component and its assets into your app with the Native Animation CLI, or paste the agent prompt into Claude Code, Codex or Cursor once the MCP server is connected.

About this animation

A React Native morphing button can keep creation or editing in context by turning one floating action into the form itself. This component transforms a compact button into a measured card while the background scales and dims, then lets a downward drag dismiss the result. Use it for quick notes, messages, filters, task creation, or another short workflow that should not require a separate screen. One interruptible Reanimated progress value drives position, dimensions, radius, color, backdrop depth, icon, and content timing. Gesture Handler writes directly to that same value, and Reanimated keyboard height keeps the open card above the software keyboard. Supply any background and card children, tune geometry and colors, and control the surface through callbacks or a ref.

When to use it

  • Open a quick-create form from a floating action.
  • Compose a note or message without navigation.
  • Keep an expanded card above the keyboard.
  • Dismiss an editing surface with a downward drag.

An action button that expands into a card as the screen recedes, with configurable card content, background content, button color, and card width.

Why this one

The button and card are one continuous surface rather than two views crossfading. The same interruptible progress value drives its position, dimensions, color, backdrop depth, icon, content, and drag-to-dismiss interaction. The expanded card also follows the software keyboard, preserving a 24-point gap instead of letting the form become obscured.

How it works

  1. The component measures its own container, so the closed button and open card adapt to split screens, tablets, and nested layouts.
  2. A single progress shared value springs between zero and one and interpolates the surface's position, width, height, radius, and background color.
  3. The background scales inside a rounded clipping view while a separate dimming veil fades in.
  4. Card content waits until 70% of the shape transition is complete, then fades and rises into place.
  5. A downward pan writes directly to the same progress value; release velocity and position decide whether to close or spring back open.
  6. Reanimated's keyboard height keeps the card's lower edge 24 points above the keyboard.

Install

npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets

Usage

import MorphingActionButton from './MorphingActionButton';

export function NotesScreen() {
  return (
    <MorphingActionButton background={<NotesList />}>
      <NoteForm />
    </MorphingActionButton>
  );
}

Customize the surface and control it through the forwarded ref:

import { useRef } from 'react';
import MorphingActionButton, {
  type MorphingActionButtonRef,
} from './MorphingActionButton';

export function Composer() {
  const actionRef = useRef<MorphingActionButtonRef>(null);

  return (
    <MorphingActionButton
      ref={actionRef}
      background={<Dashboard />}
      buttonColor="#20202A"
      cardColor="#111827"
      cardWidth={0.92}
      cardHeight={340}
      backdropScale={0.93}
      onOpenChange={(open) => trackComposer(open)}
      accessibilityLabel="Compose"
    >
      <ComposerForm onDone={() => actionRef.current?.close()} />
    </MorphingActionButton>
  );
}

The forwarded ref exposes open() and close().

Props

PropTypeDefaultDescription
childrenReact.ReactNodeRequiredContent displayed inside the expanded card.
backgroundReact.ReactNode—Screen content behind the transforming surface.
buttonColorstring'#111111'Collapsed button color.
cardColorstring'#16161C'Expanded card color.
cardWidthnumber0.88Expanded width as a fraction of the container.
cardHeightnumber300Expanded height in points.
backdropScalenumber0.95Background scale while open.
onOpenChange(open: boolean) => void—Called when opening or closing starts.
accessibilityLabelstring'Create'Label for the floating action and expanded card.
styleStyleProp<ViewStyle>—Outer-container style.
testIDstring—Test identifier for the outer container.

Compatibility

  • Expo SDK 58
  • React Native 0.88
  • Reanimated 4.7 and Worklets 0.13
  • iOS: supported
  • Android: supported
  • Web: supported
  • Works in Expo Go because its native dependencies are included in the SDK

Accessibility

The action, close control, backdrop dismissal, form controls, and save action expose labels and roles. Opening moves screen-reader focus to the expanded card, and the close button provides a tap alternative to the downward gesture. With reduced motion enabled, opening, closing, and gesture settling snap directly to their destination while the keyboard avoidance remains active.

Customization notes

Movement follows gestures, scroll position, or interruptible spring physics. A global duration is not exposed; reduced-motion fades retain their short fixed timing.

FAQ

Does the morphing button work in Expo Go?
Yes. Gesture Handler, Reanimated, and Worklets are included with Expo SDK 58 and Expo SDK 57. It supports iOS, Android, and web. Each published piece is reviewed on physical iPhone and Android devices with Expo Go before release.
Can I put my own form inside the expanded card?
Yes. Pass any React node as children and any screen content as background. Card dimensions, colors, backdrop scale, accessibility label, callbacks, and imperative controls are configurable.
How are keyboard access and Reduce Motion handled?
The card follows Reanimated keyboard height and exposes labeled open, close, backdrop, and form actions. Reduce Motion snaps opening, closing, and gesture settling to their destinations.