Interactive Answers

Renewal Rings

Contract renewals on a 12-month clock — one ring per contract from today to its end date, with the notice window hatched and the next deadline picked out.

2 variantsMIT

Preview

Installation

Copies the component into components/ui and installs its dependencies and theme tokens.

pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/renewal-rings.json

Usage

Pass your own data and wire the callbacks to your agent runtime.

import { BellSimple, PencilSimpleLine } from "@phosphor-icons/react";
import { RenewalRings } from "@/components/ui/renewal-rings";

// Rendered by the agent in answer to "which contracts renew soon?"
export function RenewalsAnswer({ contracts, firstDeadline }: Props) {
  return (
    <RenewalRings
      today={new Date()}
      contracts={contracts.map((c) => ({
        id: c.id,
        name: c.account, // "Northvale"
        endDate: c.termEnd, // "2026-12-08"
        noticeDays: c.noticePeriod, // 30
        value: c.acv,
        autoRenew: c.autoRenew,
        note: c.id === firstDeadline.id ? firstDeadline.summary : undefined,
      }))}
      // The agent points at the first notice deadline.
      defaultSelectedId={firstDeadline.id}
      actions={[
        {
          label: "Draft notice",
          icon: PencilSimpleLine,
          onSelect: (c) => sendFollowUp(`Draft a non-renewal notice for ${c.name}`),
        },
        { label: "Remind me", icon: BellSimple, onSelect: (c) => remind(c.id) },
      ]}
    />
  );
}

// Pass null while contracts load; keep stale contracts and set loading when
// refetching. The skeleton uses only ring cardinality, never dates or values.
export function RenewalsState({ query }: { query: RenewalsQuery }) {
  return (
    <RenewalRings
      today="2026-11-04"
      contracts={query.data ? toContracts(query.data) : null}
      loading={query.isRefetching}
      skeleton={{ count: 7 }}
    />
  );
}

Props

PropTypeDefaultDescription
contracts*RenewalContract[] | null—Every contract, in any order. Those ending within the horizon are sorted by end date; the soonest gets the outer ring. Pass null while they load.
loadingbooleanfalseForce the layout-preserving skeleton while refetching, even when stale contracts are available.
skeleton{ count?: number }—Shape hints for the loading state; count is the number of ring placeholders before the real cardinality is known.
todaystring | Datenew Date()Start of the clock face, at 12 o'clock. Dates are compared as calendar days. Pass a fixed date (e.g. `"2026-11-04"`) when rendering on the server.
horizonMonthsnumber12Months around the clock face. Contracts ending later are left out.
windowDaysnumber90Renewal window: counted in the header pill and the center, marked by the dotted radius, and the scope of the auto-renew and ACV stats.
noticeSoonDaysnumber30Notice deadlines within this many days count as due in the footer.
maxRingsnumber6Rings drawn at most; the soonest ends are kept and the panel says "6 of 9 shown". Rings tighten to fit.
selectedIdstring | null—Controlled selection. The selected ring stays highlighted and its details stay open; hover and focus preview others.
defaultSelectedIdstring | nullnullStarting selection when uncontrolled.
onSelectedChange(id: string | null) => void—Called when a ring or its name is clicked, or picked with Enter or Space. Clicking the selected ring clears it; so does Escape. Arrow keys, Home and End move between rings.
actionsRenewalAction[]—Small follow-up buttons under the active contract's details, e.g. Draft notice or Remind me. `hidden` drops one for some contracts.
titlestring"Renewals"Header title.
subtitlestring"Next 12 months · from today"Secondary line under the title.
headingstring"Term left"Heading above the chart, also its accessible name.
detailsbooleantrueShows the details block: below the chart on narrow cards, beside it from 32rem.
statsbooleantrueShows the footer: notices due, auto-renewals and ACV up for renewal.
introbooleantrueSweeps each arc in from Today on mount, one after another. Off renders the finished chart. Skipped with reduced motion.
formatValue(value: number) => string"$1.2M"Formats ACV in the details and the footer.
formatDate(date: Date) => string"Mar 14, 2027"Formats end and notice dates. The date is UTC midnight of that day.
formatMonth(date: Date) => string"M"Month labels around the face.
localestring"en-US"Locale for the default money, date and month formats.
labelsPartial<RenewalRingsLabels>—Your own UI strings (loading announcement, title, legend, details, footer and screen-reader text), for translating. Right-to-left works under `dir="rtl"`; the rings still run clockwise.
classNamestring—Extra classes for the root element.
type RenewalContract = {
  id: string;
  name: string;             // "Northvale"
  endDate: string | Date;   // last day of the term, "2026-12-08"
  noticeDays?: number;      // hatched window before the end; 0 hides it
  value: number;            // annual contract value
  autoRenew?: boolean;
  note?: React.ReactNode;   // shown with the details, e.g. the agent's note
};

type RenewalAction = {
  label: string;
  icon?: Icon;              // Phosphor icon
  onSelect: (contract: RenewalContract) => void;
  hidden?: (contract: RenewalContract) => boolean;
};