# Roboto Studio component guidelines

The shared components for page UI on robotostudio.com: what to reach for, which variant, and what never to build by hand. Tokens are in [tokens.md](https://robotostudio.com/design/tokens.md); MDX blocks and page skeletons are in [pages.md](https://robotostudio.com/design/pages.md).

Import paths: `@workspace/ui/components/*` is `packages/ui/src/components/`; `@/components/*` is `apps/web/src/components/`.

## Actions and links

```
Does it change the URL?
 ├── No: it submits, toggles, copies or opens something → Button
 └── Yes
      ├── The page's main call to action (book a meeting, scope a call) → ArrowCtaButton
      ├── A whole card or cell is the link, and needs a "read more" cue → ArrowLink inside the <a>
      └── A link inside a sentence → next/link with a dotted underline
```

Never style a `<Link>` to look like a button by hand. The arrow glyph, press scale and hover borders live in `ArrowCtaButton`; a copy drifts the first time either changes.

### ArrowCtaButton

`@/components/arrow-cta-button`. A `<Link>` (a plain `<a>` for `#hash` targets, so the page re-scrolls) with the 8-bit arrow glyph.

Variants: `primary`, `secondary`. Nothing else exists.

- `primary`, the default: the single most important action in a band. One per band; two primaries means the band has no hierarchy.
- `secondary`: the second action beside a primary ("View our work" next to "Book a meeting"). Never on its own.

Pairs sit in `inline-grid w-full grid-cols-1 gap-4 sm:w-fit sm:grid-cols-[max-content_max-content]`, so they stack full width on phones.

```tsx
// Correct: apps/web/src/app/services/[service]/page.tsx
<ArrowCtaButton href="#contact">Book a meeting</ArrowCtaButton>
<ArrowCtaButton href="/case-study" variant="secondary">
  View our work
</ArrowCtaButton>

// Incorrect: Button for navigation, and a second primary
<Button onClick={() => router.push("/contact")}>Book a meeting</Button>
<ArrowCtaButton href="/case-study">View our work</ArrowCtaButton>
```

`CTAButtons` (`@/components/buttons/cta-buttons`) is the same pair hand-built for MDX `<Hero>`. Don't add new callers; use two `ArrowCtaButton`s.

### Button

`@workspace/ui/components/button`. A `<button>` (or its child with `asChild`) for actions that stay on the page.

Variants: `default`, `outline`, `secondary`, `ghost`, `destructive`, `link`, `arrow`. Sizes: `default`, `sm`, `lg`, `icon`. Nothing else exists.

```
Is it destructive or hard to undo?
 ├── Yes → variant="destructive"
 └── No
      ├── Is it the form's submit, or the one action in a panel? → default (omit variant)
      ├── Is it an icon-only control, such as a pager arrow? → variant="outline" size="icon", with an aria-label
      └── Is it the weaker choice beside a default, such as a dialog's "Send it anyway"? → variant="ghost"
```

Real callers: `default` for form submits (`confirm-call.tsx`); `outline size="icon"` for pager arrows (`pagination.tsx`, `content-filters/content-index-static.tsx`); `ghost` beside a default in a dialog footer (`sections/interview-form.tsx`). `destructive`, `secondary`, `link` and `arrow` have no production caller; don't start one without a reason in the PR.

```tsx
// Correct: apps/web/src/components/confirm-call.tsx
<Button disabled={formState.isSubmitting} type="submit">

// Incorrect: ghost isn't a submit style, and the label is title case
<Button type="submit" variant="ghost">Book A Call</Button>
```

### ArrowLink

`@workspace/ui/components/arrow-link`. Renders a `<span>` with a circular arrow disc; it is not a link on its own. Put it inside the `<a>` or `<Link>` that wraps the card, and give that wrapper `group` so the arrow turns on hover.

```tsx
// Correct: apps/web/src/app/careers/page.tsx
<Link className="group mt-2 inline-block" href="/contact">
  <ArrowLink>Get in touch</ArrowLink>
</Link>

// Incorrect: ArrowLink as the link, so there is no href and no hover
<ArrowLink href="/contact">Get in touch</ArrowLink>
```

## Layout

Every full-width band of a page is a `GridContainer`, separated from the next band by a `Border`. That is the grid: two vertical rails down the page, horizontal hairlines between bands.

### GridContainer

`@/components/design/grid-container`. A `section.container` (max 1400px) holding a `div` with `border-line border-x`: the page rails. Put padding and grids on the inner `div` through `className`. Never draw your own side borders; a second rail doubles the line.

### Border

`@/components/design/border`. Variants: `single`, `double`. Nothing else exists.

- `double`: between two bands. Two hairlines 16px apart, with the rails running through the gap. This is the one used between page sections.
- `single`, the default: one hairline inside a band, such as under a header row.

Add `className="-mt-px"` to a `double` that follows a grid whose cells draw their own bottom border, so the two lines merge. A page template frames its body with a `double` on each side, so the first and last block of a body never adds one. The full placement rules are in pages.md.

### Subheading

Two components share the name. Pick by where you are:

- In MDX: `Subheading` from `@/components/mdx/subheading`. It draws no border; the author puts a `<Border variant="double" />` on each side.
- In a page `.tsx`: `Subheading` from `@/components/subheading`. It draws its own top and bottom hairline (`-my-px border-y`), so don't wrap it in `Border`.

Both render the mono label style, centered.

### Reveal

`@/components/design/reveal`. Fades its child up 16px once, on scroll. `index` staggers siblings by 50ms, capped at index 8, the ninth sibling. `OffsetSection`, `Subheading` (MDX), `CentralHero` and `CTASection` already wrap their content in it; don't wrap them again. Pass `reveal={false}` to `OffsetSection` on pages that are a task, such as a form, rather than a read.

### Plus and DottedPlusBox

`Plus` (`@/components/design/plus`, sizes `default` and `sm`) marks grid intersections; the caller positions it (`absolute`). `DottedPlusBox` (`@/components/design/dotted-plus-box`) places one at each corner of a cell. Use them only at rail intersections, never as an icon.

### ResponsiveGridWithDividers

`@/components/blog-card`. The card grid: cells separated by hairlines that continue the page rails. Every listing uses it (sectors, services, related services, case studies, videos). Never hand-build a card grid with `gap` and borders.

- `cols`: `{ base, md?, lg? }`, default `{ base: 1, md: 2, lg: 3 }`. Only these combinations have classes: 1-1-1, 1-1-2, 1-1-3, 1-2-2, 1-2-3, 1-3-3, 1-4-4, 2-2-2, 2-2-3, 2-3-3, 2-4-4, 3-3-3 (base-md-lg). Any other silently falls back to 1-2-3.
- `mobileLayout`: `grid` (default) or `snap`, a horizontal snap rail on phones.
- `withTopBorder`, `withBottomBorder` (both default true): turn off the side that touches a `Border` or a `Subheading`.
- `withGuides={false}` when the grid already sits inside a `GridContainer`. `tight` when cards draw their own `border-x`.

A card that is one link wraps its whole cell in the `<Link>` and ends with an `ArrowLink`. A card that holds its own action (a plan with "Choose plan") puts an `ArrowCtaButton variant="secondary"` at its foot, and the band's one `primary` sits outside the grid.

## Forms

Inputs come from `@workspace/ui/components/` (`input`, `textarea`, `select`, `checkbox`, `label`, `form`) and are wired through `@/components/form-fields`. Errors use `FormErrorAlert` (`@/components/form-error-alert`) for the form; a field's message is `text-destructive`, set by `FormMessage` and `form-fields.tsx`. A submitted form swaps to `FormSuccessState` through `FormWithSuccessState`; don't hand-roll a success message.

## Not for page UI

- `Badge` (`@workspace/ui/components/badge`) has no callers in `apps/web`. It is rounded, so never use it on page UI: a status on a page is a mono label. A Scene uses the kit's `Pill`.
- `Dialog`, `DropdownMenu`, `Select`, `Tooltip`, `Toggle` carry shadcn radii. Pass `rounded-none` where they render in page UI.
