# Jelly Button

> A chunky button that squashes like jelly when you press it.

- Category: Buttons
- Tier: Free (MIT)
- Page: https://bowls.dev/components/jelly-button
- Requires: React 18+, Tailwind CSS 4, motion

## Install

Copy the source below into `components/bowls/jelly-button.tsx`, then install its dependencies:

```bash
npm i motion
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | Button label. |
| `color` | `string` | `"#ff5c39"` | Face colour; the ledge is mixed from it. |
| `textColor` | `string` | `"#fff"` | Use a dark one on light faces. |
| `onClick` | `() => void` | — | Click handler. |

## Usage

```tsx
"use client";

import { JellyButton } from "@/components/bowls/jelly-button";

export default function Demo() {
  return (
    <div className="flex h-full w-full flex-wrap items-center justify-center gap-4 p-6">
      <JellyButton>Squish</JellyButton>
      <JellyButton color="#7c5cff">Me</JellyButton>
      <JellyButton color="#c6f432" textColor="#14210a">Please</JellyButton>
    </div>
  );
}
```

## Source

`components/bowls/jelly-button.tsx`

```tsx
"use client";

import { motion } from "motion/react";
import type { ReactNode } from "react";

export type JellyButtonProps = {
  children: ReactNode;
  /** Face colour. The ledge underneath is mixed from it. */
  color?: string;
  /** Text colour; use a dark one on light faces. */
  textColor?: string;
  onClick?: () => void;
  className?: string;
};

/** A chunky button that squashes like jelly when pressed. */
export function JellyButton({ children, color = "#ff5c39", textColor = "#fff", onClick, className }: JellyButtonProps) {
  return (
    <motion.button
      type="button"
      onClick={onClick}
      whileHover={{ scale: 1.04, y: -2 }}
      whileTap={{ scaleX: 1.16, scaleY: 0.84, y: 4 }}
      transition={{ type: "spring", stiffness: 520, damping: 11 }}
      style={{
        background: color,
        color: textColor,
        boxShadow: `0 6px 0 0 color-mix(in srgb, ${color} 62%, black)`,
      }}
      className={`rounded-2xl px-7 py-4 text-lg font-bold tracking-tight outline-offset-4 ${className ?? ""}`}
    >
      {children}
    </motion.button>
  );
}
```
