Emirhan Albayrak

Fold Logo

Component

About

A logo tile that folds like a foldable phone. Each half swings up on the hinge and lands in the next look, with motion blur, shadows and a spring. Drop in your own SVG or PNG, set the looks, and use it as a logo, loader or app icon. Click or press Enter to fold.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Fold Logo to your project and fits it to your theme.

Code

How Fold Logo is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { FoldLogo, type FoldLogoTheme } from "@/components/ui/fold-logo";

/* A few original marks to try. Swap in your own SVG, or use the upload button. */
const MARKS: Array<{ name: string; node: React.ReactNode }> = [
  {
    name: "Fold",
    node: (
      <svg viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="1.6" strokeLinejoin="round">
        <path d="M3.6 7.9 10.5 5v12.1L3.6 20z" />
        <path d="M13.5 5l6.9 2.9V20l-6.9-2.9z" opacity=".55" />
      </svg>
    ),
  },
  {
    name: "Spark",
    node: (
      <svg viewBox="0 0 24 24" fill="currentColor">
        <path d="M12 1.5c.7 5.9 4.6 9.8 10.5 10.5-5.9.7-9.8 4.6-10.5 10.5C11.3 16.6 7.4 12.7 1.5 12 7.4 11.3 11.3 7.4 12 1.5Z" />
      </svg>
    ),
  },
  {
    name: "Orbit",
    node: (
      <svg viewBox="0 0 24 24" fill="currentColor">
        <circle cx="11" cy="13" r="6.4" fill="none" stroke="currentColor" strokeWidth="3.4" />
        <circle cx="19.2" cy="4.8" r="2.8" />
      </svg>
    ),
  },
  {
    name: "Clover",
    node: (
      <svg viewBox="0 0 24 24" fill="currentColor">
        <circle cx="7.6" cy="7.6" r="5.1" />
        <circle cx="16.4" cy="7.6" r="5.1" opacity=".6" />
        <circle cx="7.6" cy="16.4" r="5.1" opacity=".6" />
        <circle cx="16.4" cy="16.4" r="5.1" />
      </svg>
    ),
  },
];

const PALETTES: Array<{ name: string; themes: FoldLogoTheme[] }> = [
  {
    name: "Mono",
    themes: [
      { background: "#0b0b0d", color: "#ffffff" },
      { background: "#ffffff", color: "#0b0b0d" },
      { background: "#17153b", color: "#9384ff" },
    ],
  },
  {
    name: "Ember",
    themes: [
      { background: "#1b0f0a", color: "#ff7a45" },
      { background: "linear-gradient(140deg,#ff8a3d,#ff4d3d)", color: "#fff6ee" },
      { background: "#fff3ea", color: "#e2491c" },
    ],
  },
  {
    name: "Mint",
    themes: [
      { background: "#06221c", color: "#5df2c0" },
      { background: "#dcfff3", color: "#06382d" },
      { background: "linear-gradient(140deg,#16c79a,#0a9f8d)", color: "#ffffff" },
    ],
  },
  {
    name: "Iris",
    themes: [
      { background: "linear-gradient(140deg,#5b6cff,#b25bff)", color: "#ffffff" },
      { background: "#ffffff", color: "#5b3fe0" },
      { background: "#0e0b22", color: "#b9a8ff" },
    ],
  },
];

const FONT = "'Samsung Sharp Sans','SF Pro Display',-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',system-ui,sans-serif";

export default function FoldLogoDemo() {
  const [mark, setMark] = React.useState(0);
  const [palette, setPalette] = React.useState(0);
  const [own, setOwn] = React.useState<{ url: string; name: string } | null>(null);
  const input = React.useRef<HTMLInputElement>(null);

  const pick = (file?: File | null) => {
    if (!file || !/^image\//.test(file.type)) return;
    setOwn((prev) => {
      if (prev) URL.revokeObjectURL(prev.url);
      return { url: URL.createObjectURL(file), name: file.name };
    });
  };

  const themes = PALETTES[palette].themes;
  const logo = own ? { logoSrc: own.url } : { logo: MARKS[mark].node };

  return (
    <div
      className="flex min-h-[720px] w-full flex-col items-center justify-center gap-7 bg-background px-5 py-10 text-foreground"
      style={{ fontFamily: FONT }}
      onDragOver={(e) => e.preventDefault()}
      onDrop={(e) => {
        e.preventDefault();
        pick(e.dataTransfer.files?.[0]);
      }}
    >
      <div className="flex w-full max-w-[440px] flex-col items-center rounded-[36px] border border-border bg-muted/[0.55] px-6 pb-8 pt-14">
        <FoldLogo {...logo} themes={themes} size={212} />
        <div className="mt-14 text-center">
          <div className="text-[22px] font-semibold tracking-[-0.02em]">Fold Logo</div>
          <div className="mx-auto mt-1.5 max-w-[290px] text-[13.5px] leading-snug text-muted-foreground [text-wrap:balance]">
            Your mark on a tile that folds through every look. Click it to fold it yourself.
          </div>
        </div>
      </div>

      <div className="flex w-full max-w-[440px] flex-col gap-3">
        <div className="flex items-center gap-2">
          <div className="flex flex-1 items-center gap-1 rounded-2xl border border-border bg-card p-1">
            {MARKS.map((m, i) => {
              const on = !own && i === mark;
              return (
                <button
                  key={m.name}
                  type="button"
                  aria-label={m.name}
                  aria-pressed={on}
                  onClick={() => {
                    setMark(i);
                    setOwn(null);
                  }}
                  className={
                    "grid h-10 flex-1 place-items-center rounded-xl transition-colors " +
                    (on ? "bg-foreground text-background" : "text-muted-foreground hover:bg-muted hover:text-foreground")
                  }
                >
                  <span className="block h-[19px] w-[19px] [&>svg]:h-full [&>svg]:w-full">{m.node}</span>
                </button>
              );
            })}
          </div>
          <button
            type="button"
            onClick={() => input.current?.click()}
            className={
              "flex h-12 items-center gap-2 rounded-2xl border px-4 text-[13.5px] font-semibold transition-colors " +
              (own ? "border-foreground bg-foreground text-background" : "border-border bg-card text-foreground hover:bg-muted")
            }
          >
            <svg viewBox="0 0 24 24" className="h-4 w-4" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" aria-hidden>
              <path d="M12 16V4m0 0L7.5 8.5M12 4l4.5 4.5M4.5 15.5v2.5a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-2.5" />
            </svg>
            {own ? "Your logo" : "Try your logo"}
          </button>
          <input ref={input} type="file" accept="image/svg+xml,image/png,image/webp" className="hidden" onChange={(e) => pick(e.target.files?.[0])} />
        </div>

        <div className="flex items-center gap-1 rounded-2xl border border-border bg-card p-1">
          {PALETTES.map((p, i) => (
            <button
              key={p.name}
              type="button"
              aria-pressed={i === palette}
              onClick={() => setPalette(i)}
              className={
                "flex h-10 flex-1 items-center justify-center gap-2 rounded-xl text-[12.5px] font-semibold transition-colors " +
                (i === palette ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground")
              }
            >
              <span className="flex">
                {p.themes.map((t, j) => (
                  <span key={j} className="-ml-1 block h-3.5 w-3.5 rounded-full border border-border first:ml-0" style={{ background: t.background }} />
                ))}
              </span>
              <span className="hidden min-[400px]:inline">{p.name}</span>
            </button>
          ))}
        </div>

        <div className="flex items-center justify-between rounded-2xl border border-border bg-card px-5 py-4">
          <div>
            <div className="text-[13.5px] font-semibold">Any size</div>
            <div className="text-[12px] text-muted-foreground">Navbar, loader, app icon</div>
          </div>
          <div className="flex items-end gap-5">
            <FoldLogo {...logo} themes={themes} size={64} interval={1500} tilt={false} />
            <FoldLogo {...logo} themes={themes} size={44} interval={2100} tilt={false} />
            <FoldLogo {...logo} themes={themes} size={28} interval={2700} tilt={false} />
          </div>
        </div>
      </div>
    </div>
  );
}

More by Emirhan Albayrak

View all
  • Animated Bento Features

    Animated Bento Features

    31
  • Vitals Widget

    Vitals Widget

    30
  • Coin Rack Selector

    Coin Rack Selector

    18
  • Glow Widgets

    Glow Widgets

    12
  • Tear-Off Calendar

    Tear-Off Calendar

    8
  • Hand Pull Refresh

    Hand Pull Refresh

    7
  • Storage Folder Card

    Storage Folder Card

    6
  • Coin Plan Picker

    Coin Plan Picker

    1