# Hooks

The hooks behind the components, for building controls and behaviors of your own.

The components share a few hooks: for copying to the clipboard, reacting to scrolling, keyboard
shortcuts, loading suggestions, and connecting a control to a [Field](https://ui.jarv.is/components/field.md). Each hook
is its own registry item. To build something the components don't cover, add one the same way you
add a component:

```bash
npx shadcn@latest add @jarvis/use-copy-to-clipboard
```

The shadcn CLI copies the hook into your project's `@/hooks`, where it's yours to change. Adding a
component also adds the hooks it uses, so you may have some already.

## All hooks

- [useAsyncSuggestions](https://ui.jarv.is/hooks/use-async-suggestions.md): Loads suggestions for typed text after a pause, and reports why one is highlighted.
- [useCopyToClipboard](https://ui.jarv.is/hooks/use-copy-to-clipboard.md): Copies text to the clipboard and tracks whether it worked.
- [useField](https://ui.jarv.is/hooks/use-field.md): Connects a custom control to the Field around it: its labels, description, error and state.
- [useShortcut](https://ui.jarv.is/hooks/use-shortcut.md): Runs a callback on a keyboard shortcut and formats the shortcut for the person's platform.
