Pure helpers for computing new-tab navigation decisions and assembling `` element attribute objects for chat-rendered links.
## Key Components
### `isSameOriginAbsoluteHref(href)` *(internal)*
Checks whether a given `href` is an absolute `http(s)` URL on the current page's origin. SSR-safe — returns `false` when `window` is undefined.
### `computeIsNewTab(runtime, href, targetPlatform)`
**Single source of truth** for the new-tab decision across inline cards, source chips, and `NavLinkAnchorViaRuntime`. Implements two modes:
- **`embed` mode** — opens new tab except for same-origin absolute hrefs (e.g. embedder in-app routes under `/help-center`).
- **`host` mode** — delegates to `runtime.navigation.decideNewTab` or falls back to `libDecideNewTab`.
### `newTabAnchorAttrs(isNewTab)`
Returns `{ target: '_blank', rel: 'noopener noreferrer' }` when `isNewTab` is `true`, or `{}` otherwise. Ensures new-tab links always include `noopener noreferrer` to prevent tab-nabbing.
### `buildAnchorProps(href, isNewTab)`
Combines `href` and new-tab attributes into a single `anchorProps` object. Returns `undefined` (not a falsy object) when `href` is absent, enabling clean conditional rendering between `` and ``.
## Usage Example
```typescript
import { computeIsNewTab, buildAnchorProps } from './nav-anchor-props'
// Inside a card wrapper component
const isNewTab = computeIsNewTab(runtime, chatRef.url, targetPlatform)
const anchorProps = buildAnchorProps(chatRef.url, isNewTab)
// In JSX — renders or based on whether a URL exists
return anchorProps != null
? {children}
: {children}
// Or spread newTabAnchorAttrs directly when href is already known
import { newTabAnchorAttrs } from './nav-anchor-props'
```
**Source:** [`nav-anchor-props.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/nav-anchor-props.ts)