shadcn.io is not affiliated with official shadcn/ui
Audit Log Retention Settings Block for React
An audit log retention panel with a row for each class of event, a preset for how long to keep it, an archive-after menu, a legal hold that freezes the row and a two-part bar to one scale, with the gigabytes searchable and archived added up from typed daily volumes.
Installation
Overview
Make retention a decision people can see, with this audit log retention panel for React with Base UI. Inside a hairline frame with a plus mark on each corner, a strip of three figures leads: how many gigabytes stay searchable, how many sit in the archive and how many classes are under a legal hold. Under it a row for each class of event (sign-ins, permission changes, data access, exports) holds a Segment Group for how long to keep it (30 days, 90 days, 1 year or 7 years), a Native Select for when it moves from search to the archive, and a Switch for a legal hold. A bar under the controls draws the row's days: solid for the searchable days, a lighter weight for the archived ones, hatched when the row is held, all to one scale set by the longest row, with a sentence that says the same in words ("30 days searchable, then 335 days archived. Deleted after 1 year."). A held row keeps everything: its presets refuse to change, the sentence says since when, and its bar counts the days on hand instead. The last band counts unsaved changes in a status line beside a Shine Button to save them and an outline Button to discard them. On a phone each class is a stack of its own controls and the save bar stays pinned to the bottom of the screen. It's built from Segment Group, Native Select, Switch, Button, Shine Button and Guides, with hand-drawn bars and a CSS entrance only. For compliance, security and admin products where retention is a legal question.
FAQ
How do I fill it with my own event classes?
Edit CLASSES. Each has an id, a name, a one-line hint, gigs (its volume in gigabytes a day) and days (how many days of it are on hand, which is what a held row keeps). PRESETS and ARCHIVE are the choices in the segment group and the menu, and POLICY_START is the policy the account has saved when the page opens, class by class. The strip's figures, the bars and the sentences are all computed from these, so the numbers agree.
How are the gigabytes estimated?
Each class contributes its daily volume times the days it spends in each state: the days before it moves to the archive count as searchable, the days between that and the end of retention count as archived. A held row has no end, so it uses the days on hand instead. They are steady-state estimates from typed volumes, not measurements, and the figures say so by being rounded; replace the typed volumes with your own storage statistics.
What does a legal hold do here?
It freezes the row: nothing is deleted until the hold is released. While it is on, pressing a preset or changing the archive menu is refused with a message and focus moves to the hold switch, the bar turns hatched and the sentence names the date the hold started. Releasing it puts the row's preset back in charge. The presets are not disabled, because a disabled control can't say why; they refuse in words instead.
Why are some archive options greyed out?
Because archiving can only start before the data is deleted. With 30 days of retention, only "Never" and "7 days" make sense, so the longer options are unavailable, and choosing a shorter retention than the current archive setting switches archiving off and says so in the status line. For a held row every option shorter than the days on hand is available.
What happens when I press Save, and what stays local?
Nothing leaves the page and nothing is deleted or archived. The block keeps two copies of the policy, the saved one and the one being edited, and counts how many settings differ, so the status line can say "3 changes not saved yet." Save makes the edited copy the saved one and says it was saved in this demo; Discard puts the saved copy back. To make it real, send the policy to your retention service in the save handler, and show a retention that shortens existing data as a separate, confirmed step.
Are the bars accessible?
The bars are decoration and hidden from assistive technology; each row's sentence carries the same facts as text, and the figures at the top are a list. Solid, light and hatched differ in pattern and weight, never in color, and the legend under the list says so. A tiny bar (7 years against 90 days) keeps a minimum width so it never disappears.
Related
- Pro
Backup Schedule Settings
Backups and exportsA backup schedule panel that leads with what the schedule amounts to (the next run, how much history the copies cover, how much space they take), with frequency, time, retention and destination controls beside a list of the next five runs.
- Pro
Audit Log Settings
Alerts and auditA settings change history in a fixed-height window: changes grouped by area in folds with counts, an actor filter, and a detail pane with the before and after values, who and when, and a Revert that undoes only the latest change to a setting, marks the original and adds a revert event at the top.
- Pro
Data Export Settings
Backups and exportsA data export panel built around a tree of what an account holds, where ticking a part adds what it depends on and says so, with a format control, the size, time and file count it adds up to, and a request list that queues one archive at a time.
- Pro
Backup and Restore Settings
Backups and exportsA backups page with a list of six snapshots and the three-step restore that opens from it, shown open on load: choose what to bring back, read the impact and type the snapshot date to confirm, then watch a progress bar fill and end on a plain statement that nothing was restored in the demo.
- Pro
Account Deletion Settings
Backups and exportsA whole-page account deletion that first asks what happens to each kind of data (delete, anonymise or transfer, with invoices locked for tax law), sums the choices in one sentence, then schedules deletion 14 days out behind a typed-email alert dialog.
- Pro
Danger Zone Settings
Backups and exportsThree destructive actions that ask for more the harder they are to undo: Pause in one click, Archive behind an alert dialog, Delete behind a typed workspace name and a slide-to-confirm button, with a 14-day Restore.