Free · MIT licence · Tailwind + Motion

Morphing Discovery Bar Free React component

A pill-shaped category bar that morphs into a larger panel of options when you open it, with the shape stretching smoothly between states.

Original component by Watermelon UI · MIT licence

  • React
  • CSS
  • Navigation
  • Morph
  • Tabs
Morphing Discovery Bar

Get the code

Install in one linenpx shadcn@latest add https://registry.watermelon.sh/r/morphing-discovery-bar.json

Installs from the Watermelon UI registry through the shadcn CLI. Needs Tailwind CSS and the motion package, which the command adds for you.

'use client';

import { FaFire } from 'react-icons/fa';
import { MdFavorite } from 'react-icons/md';
import { MorphingDiscoveryBar, type Category } from '../morphing-discovery-bar';

const DISCOVERY_CATEGORIES: Category[] = [
  {
    id: 'popular',
    label: 'Popular',
    icon: <FaFire size={20} className="fill-current" />,
    activeColor: '#F9EBEF',
    activeTextColor: '#FF3B30',
  },
  {
    id: 'favorites',
    label: 'Favorites',
    icon: <MdFavorite size={20} className="fill-current" />,
    activeColor: '#F9EBEF',
    activeTextColor: '#FD2649',
  },
];

export default function MorphingDiscoveryBarDemo() {
  return <MorphingDiscoveryBar categories={DISCOVERY_CATEGORIES} />;
}

How the morphing discovery bar works

A pill-shaped category bar that morphs into a larger panel of options when you open it, with the shape stretching smoothly between states. The component is a single TypeScript file built with React, Tailwind CSS and Motion, so the animation runs on springs and shared layouts instead of hand-written keyframes.

It comes from Watermelon UI, an open-source component library released under the MIT licence. Install it with the shadcn command above, or copy the source from the code tab into your project.

Frequently asked questions

A React project with Tailwind CSS and the motion package. The shadcn command installs the component and its dependencies for you.

Want motion like this on your website?

We design and build custom websites with motion, 3D and SEO built in. Websites from $500.

More free components

Explore our work