This component no longer exists. It was in deso-ui’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-06 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
Search Bar
deso-ui/search-barRemovedBlock
A reusable search component with autocomplete functionality and keyboard navigation.
Install it
npx shadcn@latest add https://ui.deso.com/r/search-bar.jsonSource
1'use client';23import React, { useState, useRef, useEffect } from 'react';4import { Input } from '@/components/ui/input';5import { Button } from '@/components/ui/button';6import { Search, X, Loader2 } from 'lucide-react';7import { cn } from '@/lib/utils/deso';89export interface SearchBarAutocompleteItem {10 id: string;11 label: string;12 value: string;13 data?: any;14}1516export interface SearchBarProps {17 placeholder?: string;18 value?: string;19 onChange?: (value: string) => void;20 onSearch?: (value: string) => void;21 onClear?: () => void;22 onFocus?: () => void;23 className?: string;24 showSearchButton?: boolean;25 showClearButton?: boolean;26 size?: 'sm' | 'md' | 'lg';2728 // Autocomplete props29 showAutocomplete?: boolean;30 autocompleteItems?: SearchBarAutocompleteItem[];31 onSelectItem?: (item: SearchBarAutocompleteItem) => void;32 isLoading?: boolean;33 emptyMessage?: string;34 minCharsForAutocomplete?: number;35 renderItem?: (item: SearchBarAutocompleteItem) => React.ReactNode;36}3738export function SearchBar({39 placeholder = 'Search...',40 value: controlledValue,41 onChange,42 onSearch,43 onClear,44 onFocus,45 className,46 showSearchButton = false,47 showClearButton = true,48 size = 'md',4950 // Autocomplete props51 showAutocomplete = false,52 autocompleteItems = [],53 onSelectItem,54 isLoading = false,55 emptyMessage = 'No results found',56 minCharsForAutocomplete = 1,57 renderItem,58}: SearchBarProps) {59 const [internalValue, setInternalValue] = useState('');60 const [showDropdown, setShowDropdown] = useState(false);61 const [focusedIndex, setFocusedIndex] = useState(-1);62 const containerRef = useRef<HTMLDivElement>(null);63 const inputRef = useRef<HTMLInputElement>(null);6465 const value = controlledValue !== undefined ? controlledValue : internalValue;66 const shouldShowDropdown = showAutocomplete && showDropdown && value.length >= minCharsForAutocomplete;6768 // Close dropdown when clicking outside69 useEffect(() => {70 const handleClickOutside = (event: MouseEvent) => {71 if (containerRef.current && !containerRef.current.contains(event.target as Node)) {72 setShowDropdown(false);73 setFocusedIndex(-1);74 }75 };7677 document.addEventListener('mousedown', handleClickOutside);78 return () => document.removeEventListener('mousedown', handleClickOutside);79 }, []);8081 const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {82 const newValue = e.target.value;83 if (controlledValue === undefined) {84// … truncated
