---
title: "Audit Log"
description: "A list of who changed what and when, with entries that open to show each change."
---

Use it to show a history of administrative actions: role edits, channel changes, bans. Newest first. An entry reads as a sentence, "ada updated the role Moderator", and one with details opens to list them.

The kind of change is drawn as a shape before the entry (a plus, a ring, a minus) so that added, updated and removed do not depend on telling green, amber and red apart.

_Live example of Audit Log — see the page for the rendered demo._

## Installation

```bash
npx newtui@latest add audit-log
``` Registry dependencies, installed with it: avatar.

Files written — React: components/ui/audit-log.tsx. Vue: components/ui/audit-log/AuditLog.vue, components/ui/audit-log/AuditLogEntry.vue, components/ui/audit-log/AuditLogChange.vue, components/ui/audit-log/index.ts.

## Usage

React:

```tsx
import { AuditLog } from "@/components/ui/audit-log"
```

Vue:

```ts
import { AuditLog, AuditLogEntry, AuditLogChange } from "@/components/ui/audit-log"
```

## API reference

**`AuditLogEntry`**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `actor` | `string` | — | Who did it. Its first letter is the default avatar. |
| `action` | `string` | — | What they did, as the middle of a sentence: "updated the role". |
| `target` | `string` | — | What they did it to. |
| `kind` | `"create" \| "update" \| "delete"` | `"update"` | Sets the shape and colour before the entry. |
| `time` | `string` | — | The time as the reader should see it. |
| `dateTime` | `string` | — | The same moment in machine form, for the `<time>` element. |
| `avatar / #avatar` | `React.ReactNode / Vue slot` | — | Replaces the initial avatar, for one with an image. |
| `kindLabel` | `string` | — | Read by a screen reader in place of the shape. Defaults to Added, Updated or Removed. |
| `defaultOpen` | `boolean` | `false` | Start with the changes showing. |
| `children / default slot` | `AuditLogChange rows` | — | The changes. With none, the entry is a plain row that does not open. |

`AuditLog` is the ordered list and `AuditLogChange` one numbered line under an entry. Wrap the value that changed in `<strong>` to set it apart.

## Accessibility

The log is an ordered list; name it with `aria-label`. An entry with changes is a native `<details>`: its summary is a button with an expanded state, toggled by `Enter` or `Space`. The kind is announced through a hidden word (`kindLabel`) before the sentence. Give `dateTime` alongside `time`, so the moment is unambiguous to assistive technology even when the visible text says "Yesterday".

`kindLabel` replaces the English name of the kind: `Added`, `Updated` or `Removed`. [Translating labels](/docs/translating-labels) lists every English default.

## Tokens

Audit Log reads its colours, radii and motion from the `--newt-*` tokens. Override a token rather than editing the component.
