# KptMention (kpt-mention) / KptMentions (kpt-mentions) Mentions in text: `@someone` as an element you can hover to see a peek card with the rest of the connections. `kpt-mention` is a single mention; `kpt-mentions` turns a whole paragraph into text plus mentions. Requires `import '@angular/cdk/overlay-prebuilt.css';` (the card runs on `kpt-peek`) Import: `import { KptMention, KptMentions } from '@konce-pt/angular';` ## KptMention - inputs - `item`: `KptMentionItem` - the whole entry at once; the single inputs below win over it - `id`, `label`, `kind`: string - `kind` lands in `data-kind`, so it can be styled per type - `prefix`: string (default '@') - an empty string leaves the bare name - `href`: string | null - with it the mention is a link, without it a button opening the card - `placement`, `openDelay` - passed to `kpt-peek` - `disabled`: boolean - no card; the mention stays a plain highlighted word - projected content = the card ## KptMentions - inputs - `text`: string - the content with `@id` or `@[Name with spaces](id)` - `items`: `readonly KptMentionItem[]` - entries the ids resolve against - `prefix`, `placement` - passed to every mention - an `` inside = the card; its context is the item as `$implicit` plus `id` and `label` ## Example {{ item?.data?.role ?? label }} ## The text stays text `kpt-mentions` does not render HTML: the paragraph goes in as a plain string, `parseMentionText()` from `@konce-pt/mention` splits it into segments and the mention is an element the library builds itself. An application does not have to push user-written content through a sanitizer to get mentions out of it. An id that is not on the list still renders - the label falls back to the id, because a note has to stay readable after someone leaves the team. Without a card template the mention is a highlighted word, not a button: there is nothing to open, so it does not pretend otherwise. ## The id is what is stored `id` survives a rename, the label does not - that is why the text carries the id and the name comes from `items`. `@[Anna Kowalska](anna.k)` is the only way to write a name with spaces, and even then the list wins over the label written into the text: data is usually fresher than a note from last month. ## Mentions in the editor `kpt-rich-text` has `mentions`, `mentionLimit` and `(mentioned)`: typing `@` opens the suggestion list, arrows and Enter (or Tab) insert the mention as ``. The id survives saving, and `contenteditable="false"` keeps the mention in one piece - without it the caret would walk into the middle of a surname. ## Tokens The mention is underlined with a **dotted** line: `--kpt-color-primary-border` at rest, darkening to `--kpt-color-primary` on hover and while the card is open. Dotted, not solid - a solid underline would read as a link, and a mention usually leads nowhere, it opens a card. Text `--kpt-color-primary`; a mention without a card `--kpt-color-text` + `--kpt-font-weight-medium` and no line at all, since there is nothing to promise. Focus ring `--kpt-color-focus-ring`. The card takes its own tokens from `kpt-peek`.