Discover Button
uselayouts/discover-buttonFreeComponent
An interactive button with expanding discovery state.
Live preview
live · rendered by the registry
Rendered by uselayouts on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://uselayouts.com/r/discover-button.jsonSource
1"use client";23import { useState } from "react";4import { motion } from "motion/react";56import {7 Search01Icon,8 FavouriteIcon,9 Fire02Icon,10 MultiplicationSignIcon,11} from "@hugeicons/core-free-icons";12import { HugeiconsIcon } from "@hugeicons/react";1314// Change Here15const TABS = [16 {17 id: "popular",18 label: "Popular",19 icon: Fire02Icon,20 color: "text-red-500",21 fill: "fill-red-500",22 bg: "bg-red-50",23 },24 {25 id: "favorites",26 label: "Favorites",27 icon: FavouriteIcon,28 color: "text-gray-900",29 fill: "fill-gray-900",30 bg: "bg-gray-100",31 },32] as const;3334export default function DiscoverButton() {35 const [activeTab, setActiveTab] = useState<(typeof TABS)[number]["id"]>(36 TABS[0].id37 );38 const [isSearchExpanded, setIsSearchExpanded] = useState(false);3940 return (41 <div className="flex items-center gap-3 p-2 h-full ">42 {/* Search Button / Input */}43 <motion.div44 layout45 transition={{46 type: "spring",47 damping: 20,48 stiffness: 230,49 mass: 1.2,50 }}51 onClick={() => !isSearchExpanded && setIsSearchExpanded(true)}52 className={`flex items-center bg-white rounded-[3rem] shadow-lg cursor-pointer h-[60px] overflow-hidden relative px-[1.125rem] ${53 isSearchExpanded ? "flex-1" : ""54 }`}55 >56 <div className="shrink-0">57 <HugeiconsIcon58 icon={Search01Icon}59 className="w-6 h-6 text-gray-800"60 />61 </div>6263 <motion.div64 initial={false}65 animate={{66 width: isSearchExpanded ? "auto" : "0px",67 opacity: isSearchExpanded ? 1 : 0,68 filter: isSearchExpanded ? "blur(0px)" : "blur(4px)",69 marginLeft: isSearchExpanded ? "12px" : "0px",70 }}71 transition={{72 type: "spring",73 damping: 20,74 stiffness: 230,75 mass: 1.2,76 }}77 className="overflow-hidden -mb-0.5 flex items-center"78 >79 <input80 type="text"81 placeholder="Search"82 className="border-0 outline-none bg-transparent text-lg focus-visible:ring-0 focus-visible:ring-offset-0 w-full"83 onClick={(e) => e.stopPropagation()}84 />85 </motion.div>86 </motion.div>8788 {/* Tab Container / Close Button */}89 <motion.div90 layout91 transition={{92 type: "spring",93 damping: 20,94// … truncated
What it pulls in
npm packages
Files it writes
More from uselayouts
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 3D Book3d-book | uselayouts | Components | Free | 3 deps | |
| Animated Collectionanimated-collection | uselayouts | Components | Free | 5 deps | |
| Bento Cardbento-card | uselayouts | Components | Free | 5 deps | |
| Bottom Menubottom-menu | uselayouts | Components | Free | 6 deps | |
| Bucketbucket | uselayouts | Components | Free | 5 deps · 2 files | |
| Day Pickerday-picker | uselayouts | Components | Free | 5 deps | |
| Delete Buttondelete-button | uselayouts | Components | Free | 5 deps | |
| Discrete Tabsdiscrete-tabs | uselayouts | Components | Free | 3 deps |
