live · mainnetoc · docs
specs · api · guides
docs / documentation

@orangecheck/auth-client


@orangecheck/auth-client / useOcAddressSuggestion

Function: useOcAddressSuggestion()

function useOcAddressSuggestion(options: UseOcAddressSuggestionOptions): UseOcAddressSuggestionReturn;

Defined in: src/components.tsx:517

Hook variant of OcAddressInput. Use when you want to keep your existing styled <input> (e.g. shadcn <Input>) and just bolt on the session-address suggestion behaviour.

Wrap your input in a position: relative container, spread inputProps onto the input, and render {popover} immediately after. The hook's focus / blur / keydown handlers are composed via inputProps — they call any handlers you've already passed to your input only when you wire them yourself in addition to spreading inputProps.

Example:

const { inputProps, popover } = useOcAddressSuggestion({
    value: addr,
    onValueChange: setAddr,
});
return (
    <div className="relative">
        <Input
            value={addr}
            onChange={(e) => setAddr(e.target.value)}
            {...inputProps}
            placeholder="bc1q…"
        />
        {popover}
    </div>
);

Parameters

ParameterType
optionsUseOcAddressSuggestionOptions

Returns

UseOcAddressSuggestionReturn