Search Bar

Search bar component with keyboard shortcuts (Ctrl+K) and modal support

$ npx @hritik-sharmaa/repeat-ui add commons-search-bar
Category
Commons
Added
Sep 4, 2025
Version
2.0.0
Packages
lucide-react
Flavors
TS · JS · Tailwind · CSS
Live preview
Customize
300px
12px
import CommonsSearchBar from "@/components/repeat-ui/commons-search-bar/preview";

<CommonsSearchBar placeholder="Search..." hotkey="k" />

Installation

  1. Run the command

    Adds the files and installs any packages they need. Works with npm, pnpm, yarn and bun.

    $ npx @hritik-sharmaa/repeat-ui add commons-search-bar --variant ts-tailwind
  2. Use it

    The files are in components/repeat-ui/commons-search-bar/.

    import CommonsSearchBar from "@/components/repeat-ui/commons-search-bar/preview";
    
    export default function Page() {
      return <CommonsSearchBar />;
    }

Props

PropTypeDefaultDescription
placeholderstring"Search..."Placeholder text.
enableModalbooleantrueOpen a search dialog instead of searching inline.
enableHotkeybooleantrueToggle the dialog with Ctrl/⌘ + hotkey, and show the shortcut.
hotkeystring"k"The letter used with Ctrl/⌘.
widthnumber300Width of the field in pixels.
radiusnumber12Corner radius in pixels.
accentColorstring"#f97316"Focus outline colour.
onSearch(query: string) => void-Called on Enter in the dialog, or on every keystroke inline.
classNamestring""Extra classes for the root element.

More commons

See all