Renders free text that may contain @ and # mentions, resolved for the
person looking at it.
<.mention_text text={@comment.content} scope={@phoenix_kit_current_scope} />Each mention becomes one of three things, and which one is a permission decision made per viewer, at render:
a link — they may open it, so they get the live title and a real deep-link. The title is re-resolved rather than taken from the text, so a renamed record reads correctly.
plain text — it is gone, or its module was uninstalled. They get the label the author saw, unlinked. This is the case that justifies keeping the label in the text at all.
the title plus a lock — it exists and they may not open it. The sentence still reads as the thing it names; the lock says it isn't theirs, and clicking asks the owners for access. No link.
The third case shows a LIVE title by default, on the view that a record's
name is rarely the secret — the access is. Installs where the name IS
sensitive turn on mentions_redact_titles, and a forbidden mention then
falls back to the label the author stored, so a record renamed after the
fact never shows its new name to someone who cannot open it.
Wiring the request-access click
The chip pushes "pk_request_access" with type and uuid. Handle it
yourself, or get the handler and the dialog for free:
use PhoenixKit.Mentions.Live…then render <.access_request_dialog request={@pk_access_request} />
somewhere in the template — the handler only stages the request; the
dialog is what asks for the note and submits it.
Without either, the click is inert — the chip still renders and still tells the reader why they cannot see the thing.
No JavaScript
Everything here is server-rendered. The typeahead that inserts mentions is a progressive enhancement; reading them has never needed JS.
Summary
Functions
Attributes
text(:string) - Defaults tonil.scope(:any) - the viewer — decides what resolves. Defaults tonil.class(:any) - Defaults tonil.allow_request(:boolean) - offer "ask for access" on a redacted mention. Defaults totrue.withhold_titles(:boolean) - For PUBLIC surfaces. A mention the viewer may not see renders with no title and no stored label at all, rather than the usual name-plus-lock. Independent of thementions_redact_titlessetting, which is a judgement about internal readers and says nothing about the open web.Defaults to
false.Global attributes are accepted.