Waqar H. Syed

Favorite toggle

Buttons 6

About

A restrained favorite control fills its star and updates the count with a short vertical transition.

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

Code

How Favorite toggle 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 Component, { type Props, type State } from "@/components/ui/favorite-toggle";
const settings = {"title": "Favorite", "showContext": true};
const ease=(x:number)=>{x=Math.max(0,Math.min(1,x));return x*x*(3-2*x)};
const pulse=(t:number,a:number,b:number)=>ease((t-a)/.3)*(1-ease((t-b)/.3));
export function showcase(time:number):State{const t=((time%6)+6)%6;const selected=t>=1.2&&t<4.5;return {active:selected?1:0,reveal:selected?ease((t-1.2)/.3):t>=4.5?1-ease((t-4.5)/.3):0,blend:selected?Math.max(0,Math.sin(Math.min(1,(t-1.2)/.35)*Math.PI)):0};}
export default function Demo(props:Props & {showcaseTime?:number}){
 const {showcaseTime,...incoming}=props;const merged={...settings,...incoming};
 return <div style={{width:"100%",minWidth:0}}><Component {...merged} state={showcaseTime===undefined?incoming.state:showcase(showcaseTime)} seeking={showcaseTime!==undefined||incoming.seeking}/></div>;
}

More by Waqar H. Syed

View all
  • Build Pipeline

    Build Pipeline

    153
  • Focus City

    Focus City

    117
  • Scroll animated timeline

    Scroll animated timeline

    116
  • Storage District

    Storage District

    65
  • Glowing Pricing Tiers

    Glowing Pricing Tiers

    45
  • Thumbnail image viewer

    Thumbnail image viewer

    43
  • Before after comparison

    Before after comparison

    33
  • Featured Project Hero

    Featured Project Hero

    29

More in Buttons

View all
  • Button

    Button

    14
  • Button

    Button

    34
  • Texture Button

    Texture Button

    92
  • Button Save

    Button Save

    46
  • Button

    Button

    64
  • Button Group

    Button Group

    3
  • App Store Button

    App Store Button

    454
  • Notification Button

    Notification Button

    103