Search input

Search field for tables and lists. Placeholder copy stays in Indonesian.

Open in Figma

Usage

import { SearchInput } from '@pilar-amoda/ui/search-input';

Table toolbar

240 wide in the table toolbar; pass className="w-full" to fill other layouts. Hover and focus are CSS states, not props.

import { SearchInput } from '@pilar-amoda/ui/search-input';

export const SearchInputBasic = () => (
  <SearchInput placeholder="Cari kode RO atau proyek" data-testid="txtSearch_Basic" />
);

Filled

When the value is not empty the clear (×) button appears (aria-label "Hapus pencarian"); it calls onValueChange("").

'use client';

import { useState } from 'react';

import { SearchInput } from '@pilar-amoda/ui/search-input';

/** Controlled: the clear (×) button appears as soon as there is a value. */
export const SearchInputFilled = () => {
  const [query, setQuery] = useState('Renovasi');

  return (
    <SearchInput
      placeholder="Cari kode RO atau proyek"
      value={query}
      onValueChange={setQuery}
      data-testid="txtSearch_Filled"
      clearButtonProps={{ 'data-testid': 'btnSearch_Clear' }}
    />
  );
};

Do and don't

Do: write a placeholder that says what can be searched.
Don't: leave the placeholder as "Search…" or English text.