Skip to main content

Import

import { SearchBar } from '@adoptaunabuelo/react-components';

Usage

<SearchBar
  type="big"
  design="primary"
  placeholder="Search..."
  onChange={(e) => handleSearch(e.target.value)}
/>

Props

type
'big' | 'small'
Size variant: big (48px height) or small (38px height)
design
'primary' | 'secondary'
Visual design: primary (gray background) or secondary (white with border)
placeholder
string
Placeholder text for the search input
onChange
(event: React.ChangeEvent<HTMLInputElement>) => void
Callback fired when the input value changes
value
string
Controlled input value
style
React.CSSProperties
Custom styles for the container
id
string
Unique identifier for the search bar

Features

  • Magnifying glass icon (lucide-react Search component)
  • Auto-focuses on click and changes style on interaction
  • Two size variants: big (48px) and small (38px)
  • Two design variants: primary (gray background) and secondary (white with border)
  • Rounded pill shape (100px border radius)
  • Font size: 14px (small) or 16px (big with secondary design)
  • Supports all standard HTML input props

Examples

Primary Design (Big)

<SearchBar
  type="big"
  design="primary"
  placeholder="Search articles..."
  onChange={(e) => setSearchQuery(e.target.value)}
/>

Secondary Design (Small)

<SearchBar
  type="small"
  design="secondary"
  placeholder="Find..."
  value={query}
  onChange={(e) => setQuery(e.target.value)}
/>
const [searchValue, setSearchValue] = useState('');

<SearchBar
  type="big"
  design="primary"
  value={searchValue}
  onChange={(e) => setSearchValue(e.target.value)}
  placeholder="Type to search..."
/>

Build docs developers (and LLMs) love