Sources
The links the agent used for a reply.
Partly measured from Shopify admin Sidekick thinking disclosure and tag link. A thinking-style disclosure over wrapped tag link chips, with the link wrapper widths from the stylesheet. Sidekick's source list was never seen live.
import { Sources } from "@replicas/ui";
const globe = (
<svg viewBox="0 0 16 16" fill="none">
<circle cx="8" cy="8" r="6.25" stroke="currentColor" strokeWidth="1.25" />
<path d="M1.75 8h12.5M8 1.75c1.75 1.8 2.5 3.9 2.5 6.25S9.75 12.45 8 14.25C6.25 12.45 5.5 10.35 5.5 8S6.25 3.55 8 1.75z" stroke="currentColor" strokeWidth="1.25" />
</svg>
);
export default function SourcesDemo() {
return (
<Sources.Root defaultOpen style={{ width: "100%", maxWidth: 420 }}>
<Sources.Trigger icon={globe}>Used 3 sources</Sources.Trigger>
<Sources.Content>
<Sources.Source href="https://pnpm.io/cli/install" icon={globe} title="pnpm install" description="pnpm.io" />
<Sources.Source href="https://pnpm.io/continuous-integration" icon={globe} title="Continuous Integration" description="pnpm.io" />
<Sources.Source href="https://docs.github.com/actions" icon={globe} title="GitHub Actions documentation" description="docs.github.com" />
</Sources.Content>
</Sources.Root>
);
}Prompt
Copy Prompt hands your agent everything it needs to build the Sources in the Shopify style: the measured tokens, the CSS and the structure.
Show Prompt
# Shopify Sources
The links the agent used for a reply.
Build a Sources in this project that looks and behaves like Shopify's. Measured from the running Shopify app (admin.shopify.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 primitives if it has none.
Fidelity: Partly measured from Shopify admin Sidekick thinking disclosure and tag link. A thinking-style disclosure over wrapped tag link chips, with the link wrapper widths from the stylesheet. Sidekick's source list was never seen live.
## Tokens
| Token | Light | Dark |
| --- | --- | --- |
| `--p-border-radius-100` | `.25rem` | `.25rem` |
| `--p-border-radius-200` | `.5rem` | `.5rem` |
| `--p-border-width-050` | `.125rem` | `.125rem` |
| `--p-color-border-focus` | `rgba(80,131,240,1)` | `#97adff` |
| `--p-color-icon-secondary` | `#606060` | `#aaa` |
| `--p-color-text` | `#101010` | `#eee` |
| `--p-color-text-secondary` | `rgba(74,74,74,1)` | `#aaa` |
| `--p-font-family-sans` | `"ShopifyInter", "Noto Sans Arabic", "Noto Sans Hebrew", ui-sans-serif, system-ui, sans-serif` | `"ShopifyInter", "Noto Sans Arabic", "Noto Sans Hebrew", ui-sans-serif, system-ui, sans-serif` |
| `--p-font-letter-spacing-body-medium` | `-.01em` | `-.01em` |
| `--p-motion-duration-150` | `150ms` | `150ms` |
| `--p-motion-ease` | `cubic-bezier(.25, .1, .25, 1)` | `cubic-bezier(.25, .1, .25, 1)` |
| `--p-space-025` | `.0625rem` | `.0625rem` |
| `--p-space-050` | `.125rem` | `.125rem` |
| `--p-space-100` | `.25rem` | `.25rem` |
| `--p-space-150` | `.375rem` | `.375rem` |
| `--p-space-200` | `.5rem` | `.5rem` |
| `--p-space-300` | `.75rem` | `.75rem` |
| `--p-font-size-275` | `.6875rem` | `.6875rem` |
| `--p-font-size-325` | `.8125rem` | `.8125rem` |
| `--p-font-line-height-500` | `1.25rem` | `1.25rem` |
| `--p-color-bg-fill-secondary` | `#ebebeb` | `#373737` |
| `--p-color-bg-fill-secondary-hover` | `#ddd` | `#414141` |
| `--p-color-bg-fill-secondary-active` | `#d0d0d0` | `#585858` |
| `--sidekick-header-hover-bg` | `color-mix(in srgb, var(--p-color-bg-surface-secondary-hover), var(--p-color-bg-surface-active))` | `color-mix(in srgb, var(--p-color-bg-surface-secondary-hover), var(--p-color-bg-surface-active))` |
| `--sidekick-disclosure-padding` | `.3125rem` | `.3125rem` |
| `--sidekick-disclosure-glyph` | `.8125rem` | `.8125rem` |
| `--duration-sidekick-disclosure` | `200ms` | `200ms` |
| `--duration-sidekick-chevron` | `150ms` | `150ms` |
## CSS
Scoped under `[data-style="shopify"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.
```css
[data-style="shopify"] {
.ui-sources {
display: flex;
flex-direction: column;
min-width: 0;
color: var(--p-color-text-secondary);
font-family: var(--p-font-family-sans);
font-size: var(--p-font-size-325);
line-height: var(--p-font-line-height-500);
letter-spacing: var(--p-font-letter-spacing-body-medium);
}
.ui-sources-trigger {
box-sizing: border-box;
display: inline-flex;
align-items: center;
align-self: flex-start;
gap: var(--p-space-150);
max-width: calc(100% + var(--p-space-200));
margin: 0 0 0 calc(var(--p-space-200) * -1);
padding: var(--sidekick-disclosure-padding) var(--p-space-200);
border: none;
border-radius: var(--p-border-radius-200);
background-color: transparent;
color: var(--p-color-text-secondary);
font: inherit;
letter-spacing: inherit;
text-align: start;
white-space: nowrap;
user-select: none;
cursor: pointer;
transition: background-color var(--p-motion-duration-150) var(--p-motion-ease);
&:focus-visible {
outline: var(--p-border-width-050) solid var(--p-color-border-focus);
outline-offset: var(--p-space-050);
}
@media (hover: hover) {
&:hover {
background-color: var(--sidekick-header-hover-bg);
}
}
}
.ui-sources-icon {
display: flex;
flex-shrink: 0;
color: var(--p-color-icon-secondary);
& svg {
width: var(--sidekick-disclosure-glyph);
height: var(--sidekick-disclosure-glyph);
}
}
.ui-sources-title {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.ui-sources-chevron {
order: -1;
flex-shrink: 0;
width: var(--sidekick-disclosure-glyph);
height: var(--sidekick-disclosure-glyph);
color: var(--p-color-icon-secondary);
transition: transform var(--duration-sidekick-chevron) var(--p-motion-ease);
[data-panel-open] > & {
transform: rotate(90deg);
}
}
.ui-sources-content {
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: var(--p-space-200) var(--p-space-100);
height: var(--collapsible-panel-height);
padding-block-start: var(--p-space-200);
overflow: hidden;
transition:
height var(--duration-sidekick-disclosure) var(--p-motion-ease),
padding-block var(--duration-sidekick-disclosure) var(--p-motion-ease),
opacity var(--duration-sidekick-chevron) var(--p-motion-ease);
&[data-starting-style],
&[data-ending-style] {
height: 0;
padding-block: 0;
opacity: 0;
}
}
.ui-sources-source {
position: relative;
box-sizing: border-box;
display: inline-flex;
align-items: center;
gap: var(--p-space-100);
min-width: 0;
max-width: 48%;
padding: var(--p-space-100) var(--p-space-150);
overflow: hidden;
border-radius: var(--p-border-radius-200);
background-color: var(--p-color-bg-fill-secondary);
color: var(--p-color-text);
font-size: var(--p-font-size-275);
line-height: var(--p-font-line-height-500);
letter-spacing: normal;
text-decoration: none;
outline: none;
transition: background-color var(--p-motion-duration-150) var(--p-motion-ease);
&:only-child {
max-width: 80%;
}
&:focus-visible {
outline: var(--p-border-width-050) solid var(--p-color-border-focus);
outline-offset: var(--p-space-025);
}
@media (hover: hover) {
&:hover {
background-color: var(--p-color-bg-fill-secondary-hover);
}
}
&:active {
background-color: var(--p-color-bg-fill-secondary-active);
}
}
.ui-sources-source-icon {
display: flex;
flex-shrink: 0;
color: var(--p-color-icon-secondary);
& :is(svg, img) {
width: var(--p-space-300);
height: var(--p-space-300);
border-radius: var(--p-border-radius-100);
}
}
.ui-sources-source-title {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ui-sources-source-description {
flex-shrink: 0;
color: var(--p-color-text-secondary);
white-space: nowrap;
&::before {
content: "·";
margin-inline-end: var(--p-space-100);
}
}
.ui-sources-source-hint {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.ui-sources-source-arrow {
display: none;
}
@media (prefers-reduced-motion: reduce) {
.ui-sources-trigger,
.ui-sources-chevron,
.ui-sources-content,
.ui-sources-source {
transition: none;
}
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
import type { ComponentProps, ReactNode } from "react";
import { join } from "./utils";
function Root({ className, ...props }: Omit<BaseCollapsible.Root.Props, "className"> & { className?: string }) {
return <BaseCollapsible.Root className={join("ui-sources", className)} {...props} />;
}
type TriggerProps = Omit<BaseCollapsible.Trigger.Props, "className"> & {
className?: string;
icon?: ReactNode;
};
function Trigger({ className, icon, children, ...props }: TriggerProps) {
return (
<BaseCollapsible.Trigger className={join("ui-sources-trigger", className)} {...props}>
{icon ? <span className="ui-sources-icon" aria-hidden>{icon}</span> : null}
<span className="ui-sources-title">{children}</span>
<svg className="ui-sources-chevron" viewBox="0 0 16 16" fill="none" aria-hidden>
<path d="M6 4l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
</BaseCollapsible.Trigger>
);
}
function Content({ className, ...props }: Omit<BaseCollapsible.Panel.Props, "className"> & { className?: string }) {
return <BaseCollapsible.Panel className={join("ui-sources-content", className)} {...props} />;
}
type SourceProps = Omit<ComponentProps<"a">, "title"> & {
icon?: ReactNode;
title: ReactNode;
description?: ReactNode;
};
function Source({ className, icon, title, description, children, ...props }: SourceProps) {
return (
<a className={join("ui-sources-source", className)} target="_blank" rel="noreferrer" {...props}>
{icon ? <span className="ui-sources-source-icon" aria-hidden>{icon}</span> : null}
<span className="ui-sources-source-title">{title}</span>
{description ? <span className="ui-sources-source-description">{description}</span> : null}
{children}
<span className="ui-sources-source-hint">(opens in a new tab)</span>
<svg className="ui-sources-source-arrow" viewBox="0 0 16 16" fill="none" aria-hidden>
<path d="M5.5 10.5l5-5M6.5 5.5h4v4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
</a>
);
}
export const Sources = {
Root,
Trigger,
Content,
Source,
};
```
## Example
```tsx
import { Sources } from "@replicas/ui";
const globe = (
<svg viewBox="0 0 16 16" fill="none">
<circle cx="8" cy="8" r="6.25" stroke="currentColor" strokeWidth="1.25" />
<path d="M1.75 8h12.5M8 1.75c1.75 1.8 2.5 3.9 2.5 6.25S9.75 12.45 8 14.25C6.25 12.45 5.5 10.35 5.5 8S6.25 3.55 8 1.75z" stroke="currentColor" strokeWidth="1.25" />
</svg>
);
export default function SourcesDemo() {
return (
<Sources.Root defaultOpen style={{ width: "100%", maxWidth: 420 }}>
<Sources.Trigger icon={globe}>Used 3 sources</Sources.Trigger>
<Sources.Content>
<Sources.Source href="https://pnpm.io/cli/install" icon={globe} title="pnpm install" description="pnpm.io" />
<Sources.Source href="https://pnpm.io/continuous-integration" icon={globe} title="Continuous Integration" description="pnpm.io" />
<Sources.Source href="https://docs.github.com/actions" icon={globe} title="GitHub Actions documentation" description="docs.github.com" />
</Sources.Content>
</Sources.Root>
);
}
```
## Foundations
The rest of the Shopify style, as a skill: https://replicas.raphaelsalaja.com/skills/shopify/SKILL.md