# Collection controls

- **[Atoms](/components/)**

Native search, filter and sort controls that collapse their options in narrow containers.

## Preview

collection-controls.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { CollectionControls } from '@/components/klarhimmel/ui/collection-controls';

export default function Example() {
  return (
    <Theme theme="brand">
      <CollectionControls search={{ name: "q", label: "Search articles", placeholder: "Find an article…" }} sort={{ name: "sort", label: "Sort by", options: [{ value: "newest", label: "Newest first" }] }} />
    </Theme>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/collection-controls
  ```
- **Import**

  ```
  import { CollectionControls } from '@/components/klarhimmel/ui/collection-controls';
  ```

- **Files**: collection-controls.tsx, collection-controls.css, in components/klarhimmel/ui/. With it: input, native-select, theme, utils. npm: lucide-react.
- **Render in**: Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

## Props

- **search**: A named native search input, always visible.
- **choices**: Optional radio choices with counts.
- **filters**: Named native selects with labels and options.
- **sort**: Named native selects with labels and options.
- **disabled**: Keep controls disabled until the application’s filtering is ready.
- **disclosureLabel**: Disclosure and reset labels. Empty resetLabel omits the reset button.
- **resetLabel**: Disclosure and reset labels. Empty resetLabel omits the reset button.
- **native attributes**: Every native attribute of the element passes through, className included.

[Next](/components/score-ring)
