# Lookup docs
> Lookup is a church search box and autofill SDK for any church app, from Here's My Church: one script tag, an open API, no key. People pick their church and the address, website and service times fill in.
# Overview
> Lookup is a church search box that fills in your form from Here's My Church. One script tag, an open API, no key.
Source: https://lookup.heresmychurch.com/docs
Church tools keep asking people for the same details. Lookup fills them in from [Here's My Church](https://heresmychurch.com), an open directory of 587,842 churches in 19 countries. Someone types a few letters, picks their church, and the address, website, phone and service times fill in.
## What you get
- [Quickstart](/docs/quickstart): Add the search box to a form in a few minutes, or hand the job to your agent.
- [Example apps](/docs/examples): A church management app, a nonprofit sign-up and a church website builder.
- [The widget](/docs/widget): Every attribute, event and form option, with a live preview.
- [API](/docs/api): Search and church records over plain HTTP, with open CORS and no key.
## How it works
1. **Search as you type.** Prefixes, typos and places like "church in dallas" all work, nearby churches first.
2. **Fill your form.** Pick a church and the empty fields you tagged with `data-hmc-field` fill in. Anything already typed is left alone.
3. **Share fixes back.** When someone corrects a detail Lookup filled, they can share it back to Here's My Church, one checked box at a time. A church that has claimed its listing reviews changes to it first. Otherwise Here's My Church checks them automatically, for example against the church's own website, where AI locates a quote and code confirms it, and a person reviews whatever the checks can't decide.
Because every pick comes from the same open directory, each app that uses Lookup helps keep church data accurate.
## Credits
- **[Here's My Church](https://heresmychurch.com)**, the open, crowd-sourced church directory every result comes from.
- **[OpenStreetMap](https://www.openstreetmap.org/copyright) contributors**, whose map data many listings started from (ODbL).
- **[Cam Pak](https://cameronpak.com)** and **[Sensible UI](https://sensibleui.com)**. The widget reads the same design token names Sensible UI uses, so it fits right in on those pages.
Lookup was built for the AI for Church hackathon and is open source on [GitHub](https://github.com/harvouscom/lookup).
---
# Quickstart
> Add a church search box that fills in your form. Hand this to your AI agent, or follow three steps yourself.
Source: https://lookup.heresmychurch.com/docs/quickstart
**Add Lookup to your app**
```text
# Add church lookup with Lookup by Here's My Church
Add a church search field to the form in this project where people enter a church (sign-up, profile, partner or settings form). When someone picks their church, its details should fill the other fields.
## Steps
1. Load the widget once on the page:
(Service times editor, optional: https://lookup.heresmychurch.com/sdk/0.4.0/service-times.js)
2. Put inside the form, above the fields it fills.
- `name` submits the chosen church's ID with the form. Store it so you can look the church up again.
- Add `required` if a church must be chosen.
- On an edit screen, set `value` to the saved ID.
3. Inputs named for the church (church_city, churchWebsite) fill on their own. Tag the other
existing inputs with data-hmc-field. Use only these names:
name, street, city, region, regionName, postalCode, country, countryName, latitude, longitude,
phone, email, website, denomination, serviceTimes, languages, ministries, pastorName, id
Don't create new inputs unless I ask. Don't rename existing ones.
4. React or Vue: the element is a custom element. React 19: pass onchurch-select and onchurch-clear props.
React 18: add `church-select` and `church-clear` listeners with addEventListener in an effect.
Vue: @church-select and @church-clear. Values are set the way typing sets them, so controlled inputs stay in sync.
Types: import type {} from "@heresmychurch/lookup/react" (or /vue).
5. While testing, add client="lookup-demo" so corrections people share are checked but never sent.
Remove it (or set your app's name) before shipping.
6. Match my styles: set --hmc-accent, --hmc-radius, --hmc-border and friends on church-lookup,
or rely on shadcn-style tokens (--background, --foreground, --accent, --radius) if the app already has them.
## Check
- Type "grace comm", pick a result, confirm the tagged fields fill and the form submits church_id.
- Keyboard: arrow keys move, Enter picks, Escape closes.
Docs: https://lookup.heresmychurch.com/llms-full.txt
```
Or set it up yourself. There's no key to request.
## 1. Add the script
```html
```
That URL is pinned to version 0.4.0 and never changes, so an update can't change your form until you change the number. To always get the latest release instead, load `https://lookup.heresmychurch.com/element.js`. See the [changelog](https://github.com/harvouscom/lookup/blob/main/packages/sdk/CHANGELOG.md) for what's in each version.
## 2. Put the search box in your form
Fields named for the church, like `church_city`, fill on their own. Tag any others with `data-hmc-field`. Give it a `name` and the chosen church's ID submits with the form.
script tag:
```html
```
client only:
```javascript
import { createLookup } from "https://lookup.heresmychurch.com/sdk/0.4.0/lookup.js";
const lookup = createLookup({ client: "my-app" });
const { results } = await lookup.search("grace comm");
const church = await lookup.getChurch(results[0].id);
```
npm:
```bash
npm install @heresmychurch/lookup
# then, once in your app: import "@heresmychurch/lookup/element";
```
## 3. Try it
Values are set the way typing sets them, so React and other frameworks see them.
> **Testing:** Add `client="lookup-demo"` while you build. Corrections people share are checked the same way, but never sent to Here's My Church.
## Next steps
- [The widget](/docs/widget): Attributes, events, icons and the form field, with a live preview.
- [Theming](/docs/theming): Match your design system with a few CSS variables.
- [Example apps](/docs/examples): Three made-up apps built with Lookup.
---
# Example apps
> Made-up apps built with Lookup, using the real widget and live data. A church management app, a nonprofit sign-up and a church website builder.
Source: https://lookup.heresmychurch.com/docs/examples
Each one is a made-up app using the real widget and live data, in demo mode so nothing you share is sent. They open full screen on the homepage.
## What each one shows
| Example | Shows |
|---|---|
| Kinship, web component | React controlled inputs, `church-select` and `church-clear` events, the share panel |
| Harvest | `name` and `required` in a plain form, service times feeding distribution hours |
| Steeple | Filling a live preview, ``, theming to a product's own look |
| Kinship, shadcn/ui | `shadcn add` from the registry, `ChurchLookup` in a React Hook Form `FormField`, `ChurchConsent` |
Every example uses `client="lookup-demo"`, so corrections are checked but never sent to Here's My Church.
---
# The widget
> is an accessible combobox: it searches as people type and fills your form when they choose.
Source: https://lookup.heresmychurch.com/docs/widget
It also asks for smarter results when people pause. Change the options below to see each one live.
## Attributes
| Attribute | What it does |
|---|---|
| `name` | Submit the chosen church's ID with your form under this name, like any input. |
| `required` | The form won't submit until a church is chosen from the list. |
| `value` | A church ID to show, such as one saved earlier on an edit screen. |
| `fill-on-load` | Also fill the form from `value` when the page loads. |
| `label`, `placeholder` | The visible label and the hint inside the box. |
| `lang` | English, Spanish, French, German, Portuguese or Polish. Defaults to the page's language. Set the `strings` property to change any text. |
| `region`, `country` | Limit results, such as `region="TX"` or `country="DE"`. |
| `near` | Rank results near a place, such as `near="Dallas"`. |
| `lat`, `lng` | Rank results near a point, such as the device's location. Set both. |
| `geo="off"` | Don't use the visitor's approximate location. |
| `form` | The id of the form to fill. Defaults to the enclosing form. |
| `fill` | Which fields to fill. See [Fields](#fields). `auto` adds plain names like `city`, `tagged` uses only tags, `off` fills nothing. |
| `overwrite` | Replace fields that already have values. |
| `limit` | Results on the first page and each **Show more**. Defaults to 8. |
| `max-results` | The most results **Show more** can reach, up to 50. Defaults to 50. Set it to `limit` to hide Show more. |
| `density="comfortable"` | Taller rows with larger icons. Rows are compact by default. |
| `icons="none"` | Hide the icon beside each result. |
| `show-distance="off"` | Hide how far away each church is. |
| `min-chars` | Characters typed before searching. Defaults to 2. |
| `debounce` | Milliseconds to wait after typing before searching. Defaults to 150. |
| `semantic="off"` | Skip the slower search after a pause, which can find churches by meaning. |
| `disabled` | Turn the field off, like any input. A disabled `fieldset` does the same. |
| `contribute="off"` | Don't offer to share corrections, report problems or add missing churches. |
| `client` | Your app's name, sent with requests. Use `lookup-demo` while testing. |
## In your form
It's a real form field. Give it a `name` and the chosen church's ID submits with your form, so you can store the ID and look the church up again later. React and Vue get types for the tag and its events. React 19 adds `onchurch-select` and other `onchurch-*` props as event listeners; React 18 needs them added in an effect.
html form:
```html
```
react 19:
```tsx
"use client"; // Next.js: load the element in a client component.
import "@heresmychurch/lookup/element";
import type {} from "@heresmychurch/lookup/react"; // types the props and onchurch-* events
function ChurchField({ onChange }) {
return (
onChange(e.detail.result.id)}
onchurch-clear={() => onChange("")}
/>
);
}
```
react 18:
```tsx
"use client"; // Next.js: load the element in a client component.
import "@heresmychurch/lookup/element";
function ChurchField({ onChange }) {
const ref = useRef(null);
useEffect(() => {
const el = ref.current;
const pick = (e) => onChange(e.detail.result.id);
const clear = () => onChange("");
el.addEventListener("church-select", pick);
el.addEventListener("church-clear", clear);
return () => {
el.removeEventListener("church-select", pick);
el.removeEventListener("church-clear", clear);
};
}, [onChange]);
return ;
}
```
vue:
```vue
(churchId = e.detail.result.id)" @church-clear="churchId = ''" />
```
## Fields
Fields named for the church fill without any setup: `church_city`, `churchWebsite`, `church[phone]`, or `autocomplete="section-church address-level2"`. It reads the field's `name`, `id` and `autocomplete`, and skips address line 2, hidden fields and passwords.
On a form that's only about the church, add `fill="auto"` and plain names fill too: `city`, `state`, `zip`, `phone`, `email`, `website`, or autocomplete tokens like `postal-code` and `tel`. A plain `name` or `id` never fills, since on most forms those are the person's.
To say exactly which field gets what, tag it with `data-hmc-field`. A tag always wins, and `data-hmc-field="none"` leaves a field alone. Use any of these: `name`, `street`, `city`, `region`, `regionName`, `postalCode`, `country`, `countryName`, `latitude`, `longitude`, `phone`, `email`, `website`, `denomination`, `serviceTimes`, `languages`, `ministries`, `pastorName` and `id`.
A `