@agentpost-tools/identityhound-ui
v0.4.0
Published
identityhound's components: the email-code sign-in, rendered in React and as Web Components on UI SDK, and as unstyled React Native building blocks (`./native`), all over the shared workflows in @agentpost-tools/identityhound-sdk/workflows.
Readme
IdentityHound UI
IdentityHound's email sign-in component handles sending and checking codes, resending, and errors. On the web, it's built on UI SDK: render it in React 19 or as Web Components, with the default look or your own layout. In React Native and Expo, ./native has unstyled parts that run the same sign-in, and a finished screen made of them is a file you copy into your app.
For React:
npm i @agentpost-tools/identityhound-ui @agentpost-tools/identityhound-react @ui-sdk/[email protected] @ui-sdk/[email protected] react react-domFor Web Components:
npm i @agentpost-tools/identityhound-ui @ui-sdk/[email protected] @ui-sdk/[email protected]You need an Agentpost workspace and a project key for a project that uses IdentityHound. In a browser app, pass its publishable key to the provider:
import { IdentityhoundProvider } from '@agentpost-tools/identityhound-react';
import { deviceSession } from '@agentpost-tools/identityhound-sdk/workflows';
import { EmailCodeSignIn } from '@agentpost-tools/identityhound-ui/react';
import '@ui-sdk/core/web.css';
import '@agentpost-tools/identityhound-ui/styles.css';
export function App({ publishableKey }: { publishableKey: string }) {
return (
<IdentityhoundProvider
publishableKey={publishableKey}
session={deviceSession({ storage: localStorage })}
>
<EmailCodeSignIn />
</IdentityhoundProvider>
);
}For React Native:
npx expo install @agentpost-tools/identityhound-ui @agentpost-tools/identityhound-react @agentpost-tools/identityhound-sdk
curl -o components/email-code-sign-in.tsx https://agentpost.tools/r/identityhound/native/email-code-sign-in.tsxThat file is the finished screen, yours to change. Or compose the parts yourself. They take style and children as values or as functions of their state, and asChild renders your own component in a part's place:
import { Pressable, Text } from 'react-native';
import {
EmailCodeSignInAlert,
EmailCodeSignInCodeInput,
EmailCodeSignInCodeStep,
EmailCodeSignInEmailInput,
EmailCodeSignInEmailStep,
EmailCodeSignInRoot,
EmailCodeSignInSend,
} from '@agentpost-tools/identityhound-ui/native';
export function SignIn() {
return (
<EmailCodeSignInRoot style={{ gap: 12 }}>
<EmailCodeSignInEmailStep style={{ gap: 12 }}>
<EmailCodeSignInEmailInput
style={(state) => ({
borderWidth: 1,
borderColor: state.invalid ? 'red' : 'gray',
})}
/>
<EmailCodeSignInSend asChild>
{(state) => (
<Pressable>
<Text>{state.pending ? 'Sending…' : 'Email me a code'}</Text>
</Pressable>
)}
</EmailCodeSignInSend>
</EmailCodeSignInEmailStep>
<EmailCodeSignInCodeStep>
<EmailCodeSignInCodeInput
style={{ borderWidth: 1, letterSpacing: 8 }}
/>
</EmailCodeSignInCodeStep>
<EmailCodeSignInAlert style={{ color: 'red' }} />
</EmailCodeSignInRoot>
);
}Email sign-in docs cover every renderer, session strategies, parts, events, and agent actions.
On 0.x, changes that break existing exports, types, props, parts, events, styles, or agent actions bump the minor version; other changes bump the patch.
Proprietary: use with Agentpost's hosted services under LICENSE.md.
