MCPcopy Index your code
hub / github.com/Balastrong/shadcn-autocomplete-demo

github.com/Balastrong/shadcn-autocomplete-demo @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
14 symbols 61 edges 18 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Autocomplete Demo

Just one more example of how to use shadcn/ui to create a custom autocomplete component.

I talk about it on this video: https://youtu.be/1hfd9CKbv7E

function App() {
  const [searchValue, setSearchValue] = useState<string>("");
  const [selectedValue, setSelectedValue] = useState<string>("");

  const { data, isLoading } = useQuery({
    queryKey: ["data", searchValue],
    queryFn: () => getList(searchValue),
  });

  return (
    <AutoComplete
      selectedValue={selectedValue}
      onSelectedValueChange={setSelectedValue}
      searchValue={searchValue}
      onSearchValueChange={setSearchValue}
      items={data ?? []}
      // Optional props
      isLoading={isLoading}
      emptyMessage="No items found."
      placeholder="Search items..."
    />
  );
}

Took inspiration from this issue and this example.

Core symbols most depended-on inside this repo

Shape

Function 14

Languages

TypeScript100%

Modules by API surface

src/components/autocomplete.tsx4 symbols
src/lib/api.ts2 symbols
src/components/ui/dialog.tsx2 symbols
src/components/ui/command.tsx2 symbols
src/lib/utils.ts1 symbols
src/components/ui/skeleton.tsx1 symbols
src/components/pokemon-card.tsx1 symbols
src/App.tsx1 symbols

For agents

$ claude mcp add shadcn-autocomplete-demo \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page