Beam Search Bar
Overview
A search bar whose bottom edge lights up with a traveling beam while it has focus.
This input component is intended for interfaces that need a search bar whose bottom edge lights up with a traveling beam while it has focus, forms, and search workflows. Its implementation is provided as editable source so the final behavior and styling stay inside your project.
Technologies
Detected package dependencies: border-beam, lucide-react.
- Accordion
- Animated Switch
- Avatar Stack
- Beam Card
- Command Search
- Dynamic Island
Focus the field — the beam travels along the bottom edge while you type.
Installation
Usage
import { BeamSearch } from "@/components/spectrumui/beam-search"<BeamSearch
placeholder="Search components…"
onChange={setQuery}
onSubmit={runSearch}
/>API Reference
BeamSearch
Uses the line preset of BorderBeam from the border-beam package (Jakub Antalík, MIT): a glow travels along the bottom edge only. The beam fades in on focus and out on blur through the library's active prop, so idle bars stay quiet. Escape clears the field.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | Controlled value |
defaultValue | string | "" | Initial value when uncontrolled |
onChange | (value: string) => void | - | Fires on every change |
onSubmit | (value: string) => void | - | Fires on Enter with the current value |
placeholder | string | "Search…" | Placeholder text |
alwaysOn | boolean | false | Keep the beam running without focus |
colorVariant | "colorful" | "ocean" | "sunset" | "mono" | "colorful" | Beam palette |
theme | "auto" | "dark" | "light" | "auto" | auto follows a .dark/.light class on <html>, then the OS preference |
trailing | ReactNode | - | Right-hand slot, e.g. a keyboard hint |
className | string | - | Classes for the wrapper |
Use cases
- interfaces that need a search bar whose bottom edge lights up with a traveling beam while it has focus
- forms
- search workflows
Features
- Copy-paste source that remains in your repository
- TypeScript source included with the component
- Tailwind CSS classes editable in the component source
- Spectrum UI registry dependencies: @spectrumui/use-surface-theme
Accessibility
- The source includes ARIA attributes or roles; preserve them when customizing the component.
- The source includes keyboard event handling; verify it alongside pointer behavior.
- Test focus order, keyboard operation, labels, contrast, and screen-reader output in the final application context.
Customization
- Edit the Tailwind utility classes in the copied source to match your spacing, color, and typography tokens.
- Use the documented className surface for local layout adjustments, then edit the source for structural changes.
Related components
Beam Search Bar FAQ
Is Beam Search Bar free to use in commercial projects?
Yes. The public Beam Search Bar source is available under the Apache License 2.0, including for commercial use, subject to the LICENSE terms.
How do I install Beam Search Bar?
Run npx shadcn@latest add @spectrumui/beam-search. The page also exposes the source for manual installation.
Does Beam Search Bar require Motion?
No Motion dependency was detected in the documented source or registry entry for Beam Search Bar.
Does Beam Search Bar use shadcn/ui or Radix UI?
No shadcn/ui or Radix UI dependency was detected in the documented Beam Search Bar source.
Can I use Beam Search Bar in Next.js?
The documented React source is used in this Next.js application. Keep its use client directive when copying it into the App Router. Install the detected dependencies and verify any application-specific data or image configuration.
What accessibility checks should I run for Beam Search Bar?
The source includes ARIA markup, keyboard handlers. Test the finished interface with keyboard and screen-reader workflows.