# Family Calendar Event

An event the agent found or drafted, with a date tile and a button to add it.

Build a Calendar Event in this project that looks and behaves like Family's. Measured from the running Family app (app.family.co). 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: Concept, not a real feature. Designed from Family's list card, the input-surface tile for the date block, muted icon rows and the secondary and primary pill buttons. Concept, not a real feature. Family has no calendar. The date tile's primary month label and the full-width actions are guesses.

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--body-color` | `#222` | `#fff` |
| `--body-color-muted` | `#17171780` | `#ffffff80` |
| `--icon-color` | `#94979e` | `#666` |
| `--body-bg` | `#fff` | `#1c1c1c` |
| `--body-bg-secondary` | `#f9fafb` | `#272727` |
| `--hr-color` | `#f0f0f0` | `#ffffff0d` |
| `--input-background` | `#f6f7f9` | `#1e1e1e` |
| `--primary` | `#9896ff` | `#9896ff` |
| `--shadow-low` | `0px 2px 24px 0px #00000008, 0px 4px 4px 0px #00000003, 0px 2px 2px 0px #00000003` | `0px 2px 24px 0px #00000008, 0px 4px 4px 0px #00000003, 0px 2px 2px 0px #00000003` |
| `--font-regular` | `"Family Inter", "Family Inter Fallback"` | `"Family Inter", "Family Inter Fallback"` |
| `--font-size-micro` | `0.6875rem` | `0.6875rem` |
| `--font-size-small` | `0.875rem` | `0.875rem` |
| `--font-size-regular` | `1rem` | `1rem` |
| `--font-size-title2` | `1.5rem` | `1.5rem` |
| `--font-weight-medium` | `500` | `500` |
| `--font-weight-semibold` | `600` | `600` |
| `--letter-spacing-small` | `-0.00563rem` | `-0.00563rem` |
| `--letter-spacing-input` | `-0.01125rem` | `-0.01125rem` |
| `--letter-spacing-title` | `-0.01625rem` | `-0.01625rem` |
| `--radius-control` | `0.875rem` | `0.875rem` |

## CSS

Scoped under `[data-style="family"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="family"] {
  .ui-calendar-event {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    column-gap: 0.875rem;
    row-gap: 1.125rem;
    padding: 1rem;
    border-radius: var(--radius-control);
    background: var(--body-bg);
    box-shadow:
      0 0 0 1px var(--hr-color),
      var(--shadow-low);
    color: var(--body-color);
    font-family: var(--font-regular);
  }

  .ui-calendar-event-date {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: start;
    height: 4rem;
    border-radius: var(--radius-control);
    background: var(--input-background);
    font-variant-numeric: tabular-nums;
    text-align: center;
  }

  .ui-calendar-event-month {
    color: var(--primary);
    font-size: var(--font-size-micro);
    font-weight: var(--font-weight-semibold);
    line-height: 0.875rem;
    letter-spacing: 0.02rem;
    text-transform: uppercase;
  }

  .ui-calendar-event-day {
    color: var(--body-color);
    font-size: var(--font-size-title2);
    font-weight: var(--font-weight-semibold);
    line-height: 1.625rem;
    letter-spacing: var(--letter-spacing-title);
  }

  .ui-calendar-event-weekday {
    color: var(--body-color-muted);
    font-size: var(--font-size-micro);
    font-weight: var(--font-weight-medium);
    line-height: 0.875rem;
  }

  .ui-calendar-event-content {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    min-width: 0;
    padding-top: 0.125rem;
  }

  .ui-calendar-event-title {
    margin: 0 0 0.125rem;
    color: var(--body-color);
    font-size: var(--font-size-regular);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25rem;
    letter-spacing: var(--letter-spacing-input);
  }

  .ui-calendar-event-time,
  .ui-calendar-event-location,
  .ui-calendar-event-attendees {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    color: var(--body-color-muted);
    font-size: var(--font-size-small);
    line-height: 1.0625rem;
    letter-spacing: var(--letter-spacing-small);

    & svg {
      width: 1rem;
      height: 1rem;
      flex-shrink: 0;
      color: var(--icon-color);
    }
  }

  .ui-calendar-event-time {
    color: var(--body-color);
    font-variant-numeric: tabular-nums;
  }

  .ui-calendar-event-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.5rem;

    & > * {
      flex: 1;
    }

    &:empty {
      display: none;
    }
  }

  &[data-theme="dark"] .ui-calendar-event {
    box-shadow: 0 0 0 1px var(--hr-color);
  }

  &[data-theme="dark"] .ui-calendar-event-date {
    background: var(--body-bg-secondary);
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import type { ComponentProps, ReactNode } from "react";
import { join } from "./utils";

function Root({ className, ...props }: ComponentProps<"article">) {
  return <article className={join("ui-calendar-event", className)} {...props} />;
}

type DateProps = Omit<ComponentProps<"span">, "children"> & { month: ReactNode; day: ReactNode; weekday?: ReactNode };

function DateTile({ className, month, day, weekday, ...props }: DateProps) {
  return (
    <span className={join("ui-calendar-event-date", className)} {...props}>
      <span className="ui-calendar-event-month">{month}</span>
      <span className="ui-calendar-event-day">{day}</span>
      {weekday ? <span className="ui-calendar-event-weekday">{weekday}</span> : null}
    </span>
  );
}

function Content({ className, ...props }: ComponentProps<"div">) {
  return <div className={join("ui-calendar-event-content", className)} {...props} />;
}

function Title({ className, ...props }: ComponentProps<"p">) {
  return <p className={join("ui-calendar-event-title", className)} {...props} />;
}

const row = (name: string, icon: ReactNode) =>
  function Row({ className, children, ...props }: ComponentProps<"span">) {
    return (
      <span className={join(`ui-calendar-event-${name}`, className)} {...props}>
        <svg viewBox="0 0 16 16" fill="none" aria-hidden>
          {icon}
        </svg>
        {children}
      </span>
    );
  };

const clock = (
  <>
    <circle cx="8" cy="8" r="5.75" stroke="currentColor" strokeWidth="1.25" />
    <path d="M8 5v3.25l2 1.25" stroke="currentColor" strokeWidth="1.25" strokeLinecap="round" strokeLinejoin="round" />
  </>
);

const pin = (
  <>
    <path d="M8 14s4.5-4.25 4.5-7.5a4.5 4.5 0 0 0-9 0C3.5 9.75 8 14 8 14z" stroke="currentColor" strokeWidth="1.25" strokeLinejoin="round" />
    <circle cx="8" cy="6.5" r="1.5" stroke="currentColor" strokeWidth="1.25" />
  </>
);

const people = (
  <>
    <circle cx="6" cy="5.5" r="2.25" stroke="currentColor" strokeWidth="1.25" />
    <path d="M2 13c.5-2.25 2-3.25 4-3.25s3.5 1 4 3.25M10.5 3.5a2.25 2.25 0 0 1 0 4.25M11.5 9.9c1.25.4 2.15 1.4 2.5 3.1" stroke="currentColor" strokeWidth="1.25" strokeLinecap="round" />
  </>
);

function Actions({ className, ...props }: ComponentProps<"div">) {
  return <div className={join("ui-calendar-event-actions", className)} {...props} />;
}

export const CalendarEvent = {
  Root,
  Date: DateTile,
  Content,
  Title,
  Time: row("time", clock),
  Location: row("location", pin),
  Attendees: row("attendees", people),
  Actions,
};
```

## Example

```tsx
import { Button, CalendarEvent } from "@replicas/ui";

export default function CalendarEventDemo() {
  return (
    <CalendarEvent.Root style={{ width: "100%", maxWidth: 440 }}>
      <CalendarEvent.Date month="Mar" day="14" weekday="Thu" />
      <CalendarEvent.Content>
        <CalendarEvent.Title>Design review</CalendarEvent.Title>
        <CalendarEvent.Time>2:00 – 3:00 PM</CalendarEvent.Time>
        <CalendarEvent.Location>Room 4B and video call</CalendarEvent.Location>
        <CalendarEvent.Attendees>Maya, Jordan and 3 others</CalendarEvent.Attendees>
      </CalendarEvent.Content>
      <CalendarEvent.Actions>
        <Button variant="primary" size="small">
          Add to calendar
        </Button>
      </CalendarEvent.Actions>
    </CalendarEvent.Root>
  );
}
```

## Foundations

The rest of the Family style, as a skill: https://replicas.raphaelsalaja.com/skills/family/SKILL.md