Skip to content

Components

SearchTrigger

Search workspace

Component reference

Properties

Use SearchTrigger

A button for opening search, with a compact icon-only option and an optional keyboard hint.

Example import style
search-trigger.tsxTSX
"use client";

import { FloodRoot, CommandPalette, SearchTrigger } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <CommandPalette title="Find a page" searchLabel="Search pages" items={[{id:"projects",label:"Projects"}]} onAction={id => {}} trigger={props => <SearchTrigger {...props} label="Find a page" />} />
    </FloodRoot>
  );
}

Design notes

  • Use SearchTrigger to open search in another surface. Use SearchInput when people can enter a query in place.
  • Use iconOnly in a compact toolbar and fullWidth in a wider sidebar. Keep the label meaningful in either layout.
  • Supply shortcut and aria-keyshortcuts only when the host has implemented that binding. The keycap is hidden for coarse pointers and icon-only triggers.

API reference

PropValuesDefault
variant"solid" | "subtle" | "outline" | "ghost""subtle"
tone"default" | "danger"—
size"2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl""sm"
loadingboolean | "retain-focus"—
labelstringRequired
iconOnlybooleanfalse
fullWidthbooleanfalse
shortcutstring | readonly string[]—
titleInherited native HTML proplabel
Native HTML propsOmit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "aria-label" | "type">Forwarded
View TypeScript source