SearchInput.tsx 738 B

12345678910111213141516171819202122232425262728
  1. import { Search } from "lucide-react";
  2. import { Input } from "@/components/ui/input";
  3. import { cn } from "@/lib/utils";
  4. export function SearchInput({
  5. value,
  6. onChange,
  7. placeholder = "Search",
  8. className,
  9. }: {
  10. value: string;
  11. onChange: (value: string) => void;
  12. placeholder?: string;
  13. className?: string;
  14. }) {
  15. return (
  16. <label className={cn("relative block w-full sm:w-72", className)}>
  17. <Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
  18. <Input
  19. aria-label={placeholder}
  20. className="pl-9"
  21. value={value}
  22. onChange={(event) => onChange(event.target.value)}
  23. placeholder={placeholder}
  24. />
  25. </label>
  26. );
  27. }