recruit/candidate-share-dialog · CandidateShareDialog

Share dialog

The dialog that makes a link to a person's profile and hands it over: who the link is for, whether it names them, a note to go with it, then the link with Copy.

Riley Okafor · GTM Engineer at Example Labs

No link has been made yet.

Install

With your coding agentInstall RecruiterOS/recruit-ui and add a dialog that shares a candidate's profile by link, named or anonymised, with a note.
With the shadcn CLIpnpm dlx shadcn@latest add RecruiterOS/recruit-ui/recruit-workflows

Props

CandidateShareDialog

PropTypeWhat it does
openrequiredboolean
onOpenChangerequired(open: boolean) => voidCalled when the dialog should close: from its close control, Done, or a share that made no link to show.
candidateNamerequiredstringWho is being shared, for the title.
avatarReactNodeTheir face beside the title, usually the kit's PersonAvatar at 44px.
headlineReactNodeUnder the title, such as their title and company.
reasonReactNodeThe sharer's own reason for putting them forward, under the title.
audiencesreadonly CandidateShareAudience[]Who the link can be for. With none, the dialog doesn't ask, and `onShare` gets no `audience`.
anonymisablebooleanOffers the choice between a page that names the person and one that doesn't.
notebooleanOffers a typed note for whoever opens the link.
noteMaxLengthnumberThe longest note the field takes.
recorderReactNodeA recorder for a spoken note, such as `CandidatePresentationRecorder`. The host owns the recording and what happens to it. With `note` as well, the two sit behind a switch, the recorder first, and the one not showing stays mounted, so a take is never lost to the switch. A side shows when its tab is pressed, with a pointer, Enter or Space; the arrow keys move between the two tabs and change nothing.
defaultNoteFormatCandidateShareNoteFormatWhich side of that switch shows as the dialog opens: `voice` (the default), or `written` for a link that already has a typed note and no recording. It is read as each opening starts; a host that learns the side later holds it as `noteFormat`.
noteFormatCandidateShareNoteFormatWhich side of that switch shows, for a host that holds it, such as one that learns which side a link's note is on only once it has read its links, or as the person sharing changes who the link names. Changing it remounts neither side, so a take in the recorder is kept, and leaves focus where it is.
onNoteFormatChange(format: CandidateShareNoteFormat) => voidCalled with the side the person sharing asks for, once each time they press the other side's tab, whether or not the host holds the side.
choicesPartial<CandidateShareChoices>The choices, for a host that holds them, such as one that fills the note in from a link it already has. Any left out are the dialog's own.
defaultChoicesPartial<CandidateShareChoices>Where the dialog's own choices start each time it opens.
onChoicesChange(choices: CandidateShareChoices) => voidCalled with every choice as it changes.
urlstring | nullThe link, where the host already has one for these choices. The dialog shows it with Copy above everything it asks, where it is in view as the dialog opens, and the share button then says `labels.update`. With no `onShare`, the dialog is the link and its Copy alone.
onShare(choices: CandidateShareChoices) => string | void | PromiseLike<string | void>Makes the link. It is given the choices and returns the link, or a promise for it; the dialog holds its controls meanwhile and then shows the link with Copy. A promise that resolves with no link closes the dialog, for a host that shows the link somewhere else. One that rejects keeps the dialog as it was, with `labels.failed`.
copyOnSharebooleanCopies the link in the same click that makes it. The clipboard is asked inside that click, for a link that arrives later; a browser that refuses leaves the link with its Copy button.
waitingForReactNodeWhat sharing is waiting for, such as a recording that is still uploading ("Finish the voice note to share"). It shows on the share button, which is held until it clears.
errorReactNodeAn error of the host's own, such as a link that couldn't be read, over the share button.
labelsPartial<CandidateShareDialogLabels>

CandidateShareAudience, each of audiences

PropTypeWhat it does
idrequiredstringTells the audience from the others, and tells the host which was picked.
labelrequiredstringIts name on the picker, such as "The client".
descriptionReactNodeWhat that audience sees when they open the link, under the picker.
fieldsReactNodeFurther fields this audience's link needs, such as where they book a call, under the description. The host draws them and holds what is typed in them: the dialog passes none of it to `onShare`.
readyboolean`false` holds the share button until the audience's own fields are filled in.
livebooleanA link for this audience is already live. Its chip says so. Unless the host also passes that link as `url`, the dialog says so in place of everything it would ask for that audience, and makes no second one.
liveDescriptionReactNodeWhat to say about the live link, in place of `labels.live`.

CandidateShareChoices, what onShare is given

PropTypeWhat it does
audiencestringWho the link is for: the `id` of one of `audiences`, or nothing when the dialog offers none.
anonymisedrequiredbooleanThe page hides who the person is. Always `false` unless the dialog is `anonymisable`.
noterequiredstringThe typed note for whoever opens the link, trimmed, or an empty string.

Data

The component takes plain values and callbacks and keeps no records of its own. Pass it yours, from the Kith data layer or from a backend you already run.