# Period Lock

> The state of an accounting period (a month): open or locked, who locked it and when, and the button to lock or unlock it after a confirmation.

Component · Data · Pro kit · [Live page](https://ui.twentyfirst.media/pro/components/PeriodLock/)

The state of an accounting period (a month): open or locked, who locked it and when, and the button to
lock or unlock it after a confirmation.

- `month` is formatted in the provider's locale ("October 2026", "Oktober 2026"); `period` takes your own text.
- `locked` / `defaultLocked` / `onLockedChange`. `onLock` and `onUnlock` may return a Promise: the button
  shows the pending state until it settles (for example while your app asks for a passkey), a rejection
  shows its message and keeps the state.
- `stepUp` labels the confirm button "Confirm with passkey"; `confirm={false}` skips the dialog;
  `readOnly` shows the state only.

## Example

```tsx
import * as React from "react";
import { Panel, PeriodLock } from "@twentyfirstmedia/pro";

export default function Preview() {
  return (
    <Panel title="Periods" style={{ gap: 8 }}>
      <PeriodLock
        month="2026-11-01"
        note="12 bookings · 2 drafts"
        onLock={() => new Promise<void>((r) => setTimeout(r, 900))}
        onUnlock={() => {}}
        stepUp
      />
      <PeriodLock
        month="2026-10-01"
        defaultLocked
        lockedAt="2026-11-03"
        lockedBy="Mara Ellis"
        onUnlock={() => new Promise<void>((r) => setTimeout(r, 900))}
        onLock={() => {}}
        stepUp
      />
      <PeriodLock month="2026-09-01" locked lockedAt="2026-10-02" lockedBy="Mara Ellis" readOnly />
    </Panel>
  );
}
```

## Props

### PeriodLock

| Prop | Type | Notes |
| --- | --- | --- |
| `surface?` | `Surface` | `"glass"` for a translucent surface over a map, photo or video; `"solid"` opts out inside a glass provider. |
| `period?` | `string` | The period's name ("October 2026"), or `month` to format it in the provider's locale. |
| `month?` | `Date \| string \| number` |  |
| `locked?` | `boolean` |  |
| `defaultLocked?` | `boolean` |  |
| `onLockedChange?` | `(locked: boolean) => void` |  |
| `onLock?` | `() => void \| Promise<void>` | A Promise shows the pending state (e.g. while a passkey is asked); a rejection its message. |
| `onUnlock?` | `() => void \| Promise<void>` |  |
| `lockedAt?` | `Date \| string \| number` |  |
| `lockedBy?` | `string` |  |
| `note?` | `string` | The line under an open period. |
| `confirm?` | `boolean` | Ask before locking and unlocking (default true). |
| `stepUp?` | `boolean` | The confirm button says "Confirm with passkey". |
| `disabled?` | `boolean` |  |
| `readOnly?` | `boolean` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Panel

| Prop | Type | Notes |
| --- | --- | --- |
| `side?` | `boolean` |  |
| `title?` | `string` |  |
| `subtitle?` | `string` |  |
| `action?` | `ReactNode` |  |
| `children?` | `ReactNode` |  |
| `surface?` | `Surface` | `"glass"`: translucent glass over what is behind (maps, 3D, video, photos); `"solid"` opts out inside a glass `UIProvider`. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
