Preview Card
A link that shows a destination preview without interrupting keyboard or screen reader navigation.
Partly measured from Palermo's Hover Card. No reference has been captured yet.
Reviewed by Jordan Lee
import { PreviewCard } from "@replicas/ui";
export default function PreviewCardDemo() {
return (
<div style={{ fontSize: "var(--font-size-small)", color: "var(--text-secondary)" }}>
Reviewed by{" "}
<PreviewCard.Root>
<PreviewCard.Trigger href="#">Jordan Lee</PreviewCard.Trigger>
<PreviewCard.Popup>
<span style={{ fontSize: "var(--font-size-mini)", color: "var(--surface-text-muted)" }}>@jordan</span>
<span style={{ fontWeight: "var(--font-weight-medium)", color: "var(--surface-text-strong)" }}>
Jordan Lee
</span>
<span style={{ fontSize: "var(--font-size-mini)", color: "var(--surface-text-muted)" }}>
Product Designer · London
</span>
</PreviewCard.Popup>
</PreviewCard.Root>
</div>
);
}Prompt
Copy Prompt hands your agent everything it needs to build the Preview Card in the Palermo style: the measured tokens, the CSS and the structure.
Show Prompt
# Palermo Preview Card
A link that shows a destination preview without interrupting keyboard or screen reader navigation.
Build a Preview Card in this project that looks and behaves like Palermo's. Measured from the running Palermo app (palermo.tryprofound.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or [Base UI](https://base-ui.com/react/components/preview-card) if it has none.
Fidelity: Partly measured from Palermo's Hover Card. No reference has been captured yet.
## Tokens
| Token | Light | Dark |
| --- | --- | --- |
| `--color-fill-quinary` | `#f0f0f0` | `#2b2a28` |
| `--text-primary` | `#18181a` | `#ecebe9` |
| `--text-secondary` | `#787878` | `#aaa8a5` |
| `--surface-bg` | `#fff` | `#171615` |
| `--surface-text` | `#18181a` | `#ecebe9` |
| `--shadow-focus` | `0 0 0 3px var(--color-shadow-ring-2)` | `0 0 0 3px var(--color-shadow-ring-2)` |
| `--shadow-medium` | `var(--surface-shadow-medium), var(--shadow-border)` | `var(--surface-shadow-medium), var(--shadow-border)` |
| `--font-regular` | `"Profound Inter", "Inter Variable", "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif` | `"Profound Inter", "Inter Variable", "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif` |
| `--font-size-mini` | `0.75rem` | `0.75rem` |
| `--font-size-small` | `0.8125rem` | `0.8125rem` |
| `--line-height-mini` | `16px` | `16px` |
| `--line-height-small` | `18px` | `18px` |
| `--font-weight-medium` | `500` | `500` |
| `--radius-menu` | `12px` | `12px` |
| `--radius-6` | `6px` | `6px` |
| `--ease-popup` | `ease` | `ease` |
| `--default-transition-timing-function` | `cubic-bezier(0.4, 0, 0.2, 1)` | `cubic-bezier(0.4, 0, 0.2, 1)` |
| `--duration-fast` | `100ms` | `100ms` |
| `--default-transition-duration` | `150ms` | `150ms` |
## CSS
Scoped under `[data-style="palermo"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.
```css
[data-style="palermo"] {
.ui-preview-card-trigger {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 0 6px;
vertical-align: middle;
border-radius: var(--radius-6);
background-color: var(--color-fill-quinary);
color: var(--text-secondary);
font-size: var(--font-size-mini);
font-weight: var(--font-weight-medium);
line-height: var(--line-height-mini);
text-decoration: none;
cursor: pointer;
outline: none;
transition: color var(--default-transition-duration) var(--default-transition-timing-function);
@media (hover: hover) {
&:hover {
color: var(--text-primary);
}
}
&[data-popup-open] {
color: var(--text-primary);
}
&:focus-visible {
box-shadow: var(--shadow-focus);
}
& svg {
width: 12px;
height: 12px;
flex-shrink: 0;
}
}
.ui-preview-card-positioner {
outline: none;
}
.ui-preview-card-popup {
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 4px;
width: 320px;
max-width: var(--available-width);
padding: 16px;
border-radius: var(--radius-menu);
background-color: var(--surface-bg);
box-shadow: var(--shadow-medium);
color: var(--surface-text);
font-family: var(--font-regular);
font-size: var(--font-size-small);
line-height: var(--line-height-small);
-webkit-font-smoothing: antialiased;
outline: none;
transform-origin: var(--transform-origin);
transition:
opacity var(--duration-fast) var(--ease-popup),
scale var(--duration-fast) var(--ease-popup),
translate var(--duration-fast) var(--ease-popup);
&[data-starting-style],
&[data-ending-style] {
opacity: 0;
scale: 0.95;
}
&[data-side="bottom"][data-starting-style] {
translate: 0 -8px;
}
&[data-side="top"][data-starting-style] {
translate: 0 8px;
}
&[data-side="left"][data-starting-style] {
translate: 8px 0;
}
&[data-side="right"][data-starting-style] {
translate: -8px 0;
}
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { PreviewCard as BasePreviewCard } from "@base-ui/react/preview-card";
import { usePortalContainer } from "./portal";
const join = (base: string, extra?: string) => (extra ? `${base} ${extra}` : base);
function Trigger({ className, ...props }: Omit<BasePreviewCard.Trigger.Props, "className"> & { className?: string }) {
return <BasePreviewCard.Trigger className={join("ui-preview-card-trigger", className)} {...props} />;
}
type PopupProps = Omit<BasePreviewCard.Popup.Props, "className"> & {
className?: string;
side?: BasePreviewCard.Positioner.Props["side"];
align?: BasePreviewCard.Positioner.Props["align"];
sideOffset?: number;
};
function Popup({ className, side = "bottom", align = "start", sideOffset = 8, ...props }: PopupProps) {
return (
<BasePreviewCard.Portal container={usePortalContainer()}>
<BasePreviewCard.Positioner className="ui-preview-card-positioner" side={side} align={align} sideOffset={sideOffset}>
<BasePreviewCard.Popup className={join("ui-preview-card-popup", className)} {...props} />
</BasePreviewCard.Positioner>
</BasePreviewCard.Portal>
);
}
export const PreviewCard = {
Root: BasePreviewCard.Root,
Trigger,
Popup,
};
```
## Example
```tsx
import { PreviewCard } from "@replicas/ui";
export default function PreviewCardDemo() {
return (
<div style={{ fontSize: "var(--font-size-small)", color: "var(--text-secondary)" }}>
Reviewed by{" "}
<PreviewCard.Root>
<PreviewCard.Trigger href="#">Jordan Lee</PreviewCard.Trigger>
<PreviewCard.Popup>
<span style={{ fontSize: "var(--font-size-mini)", color: "var(--surface-text-muted)" }}>@jordan</span>
<span style={{ fontWeight: "var(--font-weight-medium)", color: "var(--surface-text-strong)" }}>
Jordan Lee
</span>
<span style={{ fontSize: "var(--font-size-mini)", color: "var(--surface-text-muted)" }}>
Product Designer · London
</span>
</PreviewCard.Popup>
</PreviewCard.Root>
</div>
);
}
```
## Foundations
The rest of the Palermo style, as a skill: https://replicas.raphaelsalaja.com/skills/palermo/SKILL.md