# Due-date slip

The library card in the back of a book: each loan or renewal stamps the next ruled line, and the last date is when it's due. Overdue dates are stamped red. For expiring keys, trials, seats and access grants.

- Category: Records
- Built from: Stamp and seal
- Docs: https://bevel-ui.vercel.app/components/due-date-slip
- Import from: `@/components/ui/due-date-slip`

## Install

```bash
npx shadcn@latest add @bevel/due-date-slip
```

npm dependencies (installed by the CLI): `@base-ui/react`, `cn`.

## Anatomy

```tsx
<DueDateSlip title="Production API key" dates={dates} now={today}>
  <DueDateSlipStatus />
  <DueDateSlipRenew onClick={renew}>Renew 30 days</DueDateSlipRenew>
</DueDateSlip>
```

## Parts

| Part | Renders | Description |
| --- | --- | --- |
| `DueDateSlip` | div (group) + ol | title, dates (oldest first; the last counts), now. New dates land with a stamp; the history doesn't. Dates print in UTC so server and client agree. |
| `DueDateSlipStatus` | p (status) | “Due 16 Nov 2026, in 30 days.” or “Overdue by 3 days.” Describes the renew button. |
| `DueDateSlipRenew` | Button | Your onClick adds the next date. |

## Example: An expiring API key

The key lapsed four days ago. Renew it, and again, until the renewals run out.

```tsx
"use client"

import * as React from "react"
import { DueDateSlip, DueDateSlipRenew, DueDateSlipStatus } from "@/components/ui/due-date-slip"

const NOW = new Date("2026-10-17")
const DAY = 86_400_000
const iso = (d: Date) => d.toISOString().slice(0, 10)

/** An API key that expires unless renewed. Each renewal is stamped on the slip. */
export function DueDateSlipKey() {
  const [dates, setDates] = React.useState(["2026-07-15", "2026-08-14", "2026-10-13"])
  const renew = () => {
    const last = new Date(dates.at(-1)!)
    const from = last < NOW ? NOW : last
    setDates((d) => [...d, iso(new Date(from.getTime() + 30 * DAY))])
  }
  return (
    <DueDateSlip title="Production API key · sk-…4f2a" dates={dates} now={NOW}>
      <DueDateSlipStatus />
      <DueDateSlipRenew onClick={renew} disabled={dates.length >= 6}>
        {dates.length >= 6 ? "No renewals left" : "Renew 30 days"}
      </DueDateSlipRenew>
    </DueDateSlip>
  )
}
```
