# V button 24

> Animated hamburger / close toggle button

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-button-24).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-button-24
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-button-24-light-f44c7be186da3123.png
- Registry item: https://ui.cnippet.dev/r/v-button-24.json
- Categories: button
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-button-24.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/button`

## Files

### `registry/default/variants/v-button-24.tsx`

```tsx
"use client";

import { MenuIcon, XIcon } from "lucide-react";
import { useState } from "react";
import { cn } from "@/lib/utils";
import { Button } from "@/registry/default/ui/button";

export function Pattern() {
  const [open, setOpen] = useState(false);

  return (
    <Button
      aria-expanded={open}
      aria-label={open ? "Close menu" : "Open menu"}
      onClick={() => setOpen((v) => !v)}
      size="icon"
      variant="outline"
    >
      <span className="relative flex size-4 items-center justify-center">
        <MenuIcon
          aria-hidden="true"
          className={cn(
            "absolute size-4 transition-all duration-200",
            open
              ? "rotate-90 scale-75 opacity-0"
              : "rotate-0 scale-100 opacity-100",
          )}
        />
        <XIcon
          aria-hidden="true"
          className={cn(
            "absolute size-4 transition-all duration-200",
            open
              ? "rotate-0 scale-100 opacity-100"
              : "-rotate-90 scale-75 opacity-0",
          )}
        />
      </span>
    </Button>
  );
}
```
