Lookup Docs

DocsWidget

Own the code. Add a ChurchLookup component, a hook and a share-fixes panel to your shadcn app from Lookup's registry.

Lookup has two front doors with one engine behind them:

PathBest forHow
Drop it inAny page or framework, no build step, Sensible UI pages<church-lookup> from one script tag. See the widget.
Own the codeReact apps with shadcn/ui, such as ones built with Lovable or v0Add components from the registry below. They're copied into your app, so you can change them.

Both use the same headless core for search, Show more, field matching and sharing fixes back, and take the same options. The React component is yours to edit, so the two can differ once you change it.

Add Lookup to my shadcn app
Add a church picker to this React + shadcn/ui app using Lookup by Here's My Church.

1. Run: pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-lookup.json
   (it adds components/church-lookup.tsx, hooks/use-church-lookup.ts and lib/lookup-core.ts)
2. In the form that asks for a church, render <ChurchLookup /> inside a React Hook Form FormField
   named church_id: render={({ field }) => <ChurchLookup {...field} client="lookup-demo" />}
3. Inputs named for the church (church_city, churchWebsite) fill on their own. Add data-hmc-field to
   any others it should fill (name, street, city, regionName, postalCode, phone, website,
   serviceTimes). Don't rename existing fields.
4. Optional: pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-consent.json and render
   <ChurchConsent record={record} values={form.watch()} client="lookup-demo" /> under the fields,
   with record from ChurchLookup's onFill.
5. Use client="lookup-demo" while testing; set your app's name before shipping.

Check: type "grac", pick a church, the tagged fields fill and handleSubmit receives church_id.

Not on shadcn/ui? Use the element with onchurch-select props in React 19 (see the widget), or build your own picker with useChurchLookup from @heresmychurch/lookup/react (npm install @heresmychurch/lookup).

Install

bash
pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-lookup.json

That adds three files, plus shadcn's command and popover if you don't have them. The component is a client component ("use client"), so it works in the Next.js app router.

FileWhat it is
components/church-lookup.tsxChurchLookup, the search box, built from Command and Popover
hooks/use-church-lookup.tsuseChurchLookup, the engine as a hook, for your own UI
lib/lookup-core.tsThe headless core: search, fill and consent rules. Generated from @heresmychurch/lookup/core.

With React Hook Form

Spread the field onto ChurchLookup. Inputs named for the church, like church_city, fill on their own; tag any others with data-hmc-field (see Fields). Values are set the way typing sets them, so register and Controller fields both update.

tsx
<FormField
  control={form.control}
  name="church_id"
  rules={{ required: "Choose your church from the list." }}
  render={({ field }) => (
    <FormItem>
      <FormLabel>Church</FormLabel>
      <FormControl>
        <ChurchLookup {...field} client="my-app" onFill={(record) => setRecord(record)} />
      </FormControl>
      <FormMessage />
    </FormItem>
  )}
/>
<Input {...form.register("city")} data-hmc-field="city" />

Without a form library, pass name and a hidden input submits the church ID, add required if a church must be chosen, or use value and onChange for controlled state. To fill fields yourself, return false from onFill, or set fill={false}.

Props

PropWhat it does
value, onChange, onBlur, nameForm field basics. value is the church ID; setting it shows that church. A saved ID that moved calls onChange with the new one.
requiredThe form won't submit until a church is chosen from the list.
onFillCalled with the record and what will fill, before it fills. Return false to fill fields yourself.
fillWhich fields to fill: tagged and church-named by default, "auto" adds plain names like city, "tagged" only tags, false none.
fillOnLoadAlso fill from value when it's first shown.
formThe id of the form to fill. Defaults to the enclosing form.
overwriteReplace fields that already have values.
onSelect, onClear, onErrorA church is about to be chosen (return false to cancel), the choice was cleared, or something failed to load.
clientYour app's name. Use lookup-demo while testing.
region, country, near, lat, lng, geoWhere to search, as on the widget.
limit, maxResultsResults per page, and the most Show more reaches (up to 50).
minChars, debounce, semanticWhen to search: characters first, milliseconds after typing, and false to skip the search after a pause.
density, icon, searchIcon, showDistanceHow results look: "comfortable" rows, your own icons (icon={null} hides it), and distances.
lang, stringsThe text's language, and any text to change.
label, placeholderThe accessible name and the hint.
onAdd, onAdded, addChurchThe form was filled without picking a church and the person chose to add it (return false to stop), it was added (with its new ID), or addChurch={false} to never offer it.

Other languages

English is built in. For Spanish, French, German, Portuguese and Polish, add the language file once and set lang, or let it follow the page's:

bash
pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/lookup-strings.json
tsx
import "@/lib/lookup-strings"

<ChurchLookup lang="es" />

Share fixes back

bash
pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/church-consent.json
tsx
<ChurchConsent record={record} values={form.watch()} labels={{ phone: "Phone" }} client="my-app" />

It shows only fields Here's My Church accepts for that church's country. Changed fields start checked, street, city and postalCode show as one Address row, each says whether it goes live, is checked automatically or goes to the church first (a claimed listing), and nothing is sent until the person chooses Share. A checked data-hmc-share checkbox in the submitted form sends them too, without blocking the submit. When nothing changed, it asks "Still correct?" of listings nobody confirmed this year. It also offers Report a problem and a link to fix anything else on Here's My Church.

Your own UI

bash
pnpm dlx shadcn@latest add https://lookup.heresmychurch.com/r/use-church-lookup.json
tsx
const lookup = useChurchLookup({ client: "my-app" })
// lookup.search(text), lookup.results, lookup.active, lookup.move(1), lookup.choose(), lookup.loading
// lookup.hasMore and lookup.more() for the next page, lookup.error and lookup.retry()

See it working in Kinship, built with shadcn/ui.

esc

Ask AI

Answers come from these docs, written by an AI model on Cloudflare Workers AI. Check anything important against the linked page.