Hossain Jahed

Material UI Autocomplete / Combobox / Multi-select

Component 15

About

A high-fidelity Material Design 3 Autocomplete and Multi-select Combobox built for shadcn/ui. Features a custom physics-based ripple engine, cinematic staggered entrance animations, and a luxurious floating scroll area with smooth fade masks. Built-in advanced multi-select suppor

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Material UI Autocomplete / Combobox / Multi-select to your project and fits it to your theme.

Code

How Material UI Autocomplete / Combobox / Multi-select 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 { Autocomplete } from "@/components/ui/material-ui-autocomplete-combobox-multi-select";
import { Sparkles, ArrowRight } from "lucide-react";
import { cn } from "@/lib/utils";

const TECH_STACKS = [
  { value: "react", label: "React", description: "Meta Open Source", tag: "v18.2.0" },
  { value: "nextjs", label: "Next.js", description: "Vercel", tag: "v14.1.0" },
  { value: "vue", label: "Vue.js", description: "Evan You", tag: "v3.3.0" },
  { value: "svelte", label: "Svelte", description: "Rich Harris", tag: "v4.0.0" },
  { value: "astro", label: "Astro", description: "Fred K. Schott", tag: "v4.2.0" },
  { value: "tailwind", label: "Tailwind CSS", description: "Tailwind Labs", tag: "v3.4.1" },
  { value: "solid", label: "SolidJS", description: "Ryan Carniato", tag: "v1.8.0" },
  { value: "angular", label: "Angular", description: "Google", tag: "v17.0.0" },
];

export default function MultiSelectDemo() {
  const [items, setItems] = React.useState(TECH_STACKS);

  // Multi-select mode starts with 2 pre-selected items
  const [selectedValue, setSelectedValue] = React.useState<string[]>(["react", "nextjs"]);

  const handleCreate = (newLabel: string) => {
    const newValue = newLabel.toLowerCase().replace(/\s+/g, "-");
    const newItem = {
      value: newValue,
      label: newLabel,
      description: "Custom Entry",
      tag: "v1.0.0",
    };

    setItems((prev) => [newItem, ...prev]);
    setSelectedValue((prev) => [...prev, newValue]);
  };

  return (
    <div className="flex flex-col items-center justify-start min-h-screen w-full bg-background/50 pt-38 md:pt-38 px-4 pb-8 relative overflow-hidden font-sans">
      {/* Background decoration with the requested 10px blur */}
      <div className="absolute inset-0 z-0 pointer-events-none opacity-40 dark:opacity-20">
        <div className="absolute top-[-10%] left-[-10%] w-[40%] h-[40%] rounded-full bg-primary/20 blur-[10px]" />
        <div className="absolute bottom-[-10%] right-[-10%] w-[40%] h-[40%] rounded-full bg-primary/20 blur-[10px]" />
      </div>

      <div className="w-full max-w-[400px] relative z-50 flex flex-col items-center">
        <Autocomplete
          items={items}
          value={selectedValue}
          onValueChange={setSelectedValue}
          placeholder="Choose technologies..."
          emptyMessage="No framework found."
          isCreatable={true}
          onCreate={handleCreate}
        />

        {/* Layout Shift Fix: Fixed height block so it never alters standard DOM flow */}
        <div className="h-8 mt-4 relative w-full flex justify-center">
          <div
            className={cn(
              "absolute top-0 text-center text-xs text-muted-foreground transition-all duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]",
              selectedValue.length > 0 ? "opacity-100 translate-y-0" : "opacity-0 -translate-y-2 pointer-events-none"
            )}
          >
            Selected values:{" "}
            <span className="font-medium text-foreground">
              {selectedValue.length > 0 ? selectedValue.join(", ") : "none"}
            </span>
          </div>
        </div>
      </div>

      {/* Always-open Design.here Promo Card */}
      <a
        href="https://designs.here/?via=y3n4bdt4cbfq"
        target="_blank"
        rel="noopener noreferrer"
        className={cn(
          "fixed bottom-4 z-20 group flex flex-col w-[360px]",
          "bg-card/80 backdrop-blur-md border border-border shadow-sm hover:shadow-2xl rounded-2xl overflow-hidden cursor-pointer",
          "transition-all duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]"
        )}
      >
        <div className="p-2 pb-0 flex flex-col gap-3">
          <img
            src="https://cdn.21st.dev/assets/mirror/35/3591e0c4b08279a3fb82ff5385e06f697ea50012b87309a14843213c562dcbdc.png"
            alt="designs.here · Good designs. Yours to use."
            className="aspect-video object-cover rounded-lg border border-border/40 shadow-sm"
          />
          <p className="text-xs text-muted-foreground leading-relaxed pr-2">
            Beautifully crafted interfaces. Ready for your next project.
          </p>
        </div>

        <div className="p-2 flex items-center justify-between">
          <div className="flex items-center gap-2 text-sm font-medium text-foreground">
            <Sparkles className="w-4 h-4 text-primary" />
            <span className="whitespace-nowrap">designs.here</span>
          </div>
          <ArrowRight className="w-4 h-4 text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)] group-hover:translate-x-0.5 flex-shrink-0" />
        </div>
      </a>
    </div>
  );
}

More by Hossain Jahed

View all
  • Spotlight Card

    Spotlight Card

    9.7K
  • Motion Footer

    Motion Footer

    6.3K
  • Cinematic landing Hero

    Cinematic landing Hero

    6K
  • Sign In

    Sign In

    5K
  • AI prompt Box

    AI prompt Box

    3.2K
  • Glassmorphism Trust Hero

    Glassmorphism Trust Hero

    2.9K
  • Ai chat input

    Ai chat input

    2.1K
  • Limelight Nav

    Limelight Nav

    2.1K