Search Suggestions
patchui/search-suggestionsFreeBlock
patchui publishes no description for this item.
Install it
npx shadcn@latest add https://ui.hotfix.jobs/r/search-suggestions.jsonSource
1"use client";23import { MagnifyingGlass, X } from "@phosphor-icons/react/dist/ssr";4import { useId, useMemo, useRef, useState } from "react";5import type * as React from "react";6import { cn } from "@/lib/utils";7import {8 coarseTarget,9 itemGroupLabel,10 itemRow,11 selectionFocus,12} from "@/lib/recipes";13import { Button } from "@/components/ui/button";14import { Input } from "@/components/ui/input";15import {16 Popover,17 PopoverContent,18 PopoverTrigger,19} from "@/components/ui/popover";20import { Spinner } from "@/components/ui/spinner";21import {22 MOBILE_MEDIA_QUERY,23 useMediaQuery,24} from "../../hooks/use-media-query";2526export interface SearchSuggestion {27 id: string;28 label: React.ReactNode;29 value: string;30 description?: React.ReactNode;31 icon?: React.ReactNode;32 suffix?: React.ReactNode;33 disabled?: boolean;34 /**35 * When set, the row renders a trailing remove control for dismissable36 * entries in an action layer outside the listbox, so the option stays37 * atomic and the control remains visible for touch.38 */39 onRemove?: () => void;40 /** Accessible label for the remove control, e.g. `Remove "<entry>"`. */41 removeLabel?: string;42 onAction?: () => void;43 actionLabel?: string;44 actionIcon?: React.ReactNode;45}4647export interface SearchSuggestionSection {48 id: string;49 label?: React.ReactNode;50 suggestions: SearchSuggestion[];51}5253export interface SearchSuggestionsField {54 id: string;55 label: string;56 placeholder?: string;57 value: string;58 icon?: React.ReactNode;59 sections: SearchSuggestionSection[];60 loading?: boolean;61 emptyContent?: React.ReactNode;62}6364export interface SearchSuggestionsProps65 extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "onSubmit"> {66 fields: SearchSuggestionsField[];67 activeField?: string;68 defaultActiveField?: string;69 open?: boolean;70 defaultOpen?: boolean;71 onOpenChange?: (open: boolean) => void;72 onActiveFieldChange?: (fieldId: string) => void;73 onFieldValueChange: (fieldId: string, value: string) => void;74 onSuggestionSelect: (75 fieldId: string,76 suggestion: SearchSuggestion,77 ) => void;78 onSubmit: (values: Record<string, string>) => void;79 submitLabel?: string;80}8182/** Coordinated multi-field search with an anchored desktop panel and centered mobile panel. */83export function SearchSuggestions({84 fields,85 activeField: controlledActiveField,86 defaultActiveField,87 open: controlledOpen,88 defaultOpen = false,89 onOpenChange,90 onActiveFieldChange,91// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from patchui
All 51 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| App Headerapp-header | patchui | Blocks | Free | 1 dep | |
| Dropzonedropzone | patchui | Blocks | Free | 1 dep | |
| Filter Toolbarfilter-toolbar | patchui | Blocks | Free | 1 dep |
