Patterns · Dashboard
BackupsCard
The last few backups of a website, each with a restore button, plus a link to the full list. The card adapts to its own width: wide, it shows icons and sizes; narrow, it stacks like the mobile design.
import { BackupsCard } from '@statix/ui/backups-card';Examples
Desktop
In a column of 576px or more the link sits top right and each row shows an icon and the size.
Recent backups
Every night, automatically. Restoring takes about two minutes, and we back up the current state first.
- Automatic · 2.4 GB
- Automatic · 2.4 GB
- Before the WordPress update · 2.4 GB
- Automatic · 2.3 GB
Press Restore to try it.
<script lang="ts">
import { BackupsCard } from '@statix/ui/backups-card';
const backups = [
{
id: '1',
date: 'Today, 03:10',
datetime: '2026-11-18T03:10',
description: 'Automatic',
size: '2.4 GB'
},
{
id: '2',
date: 'Yesterday, 03:10',
datetime: '2026-11-17T03:10',
description: 'Automatic',
size: '2.4 GB'
},
{
id: '3',
date: 'Yesterday, 22:05',
datetime: '2026-11-17T22:05',
description: 'Before the WordPress update',
size: '2.4 GB'
},
{
id: '4',
date: 'Mon 3 Nov, 03:10',
datetime: '2026-11-03T03:10',
description: 'Automatic',
size: '2.3 GB'
}
];
let last = $state('');
</script>
<div class="flex w-full max-w-[728px] flex-col gap-3">
<BackupsCard
title="Recent backups"
description="Every night, automatically. Restoring takes about two minutes, and we back up the current state first."
{backups}
allHref="#backups"
allLabel="All 30 backups"
onrestore={(backup) => (last = backup.date)}
/>
<p class="text-small text-muted-foreground" aria-live="polite">
{last ? `Restore requested for ${last}.` : 'Press Restore to try it.'}
</p>
</div>Mobile
Below 576px card width the header stacks, icons and sizes drop and the link moves to the bottom. This follows the card width, not the viewport (container query).
Recent backups
Every night, automatically. Restoring takes about two minutes.
- Automatic
- Automatic
- Before the update
<script lang="ts">
import { BackupsCard } from '@statix/ui/backups-card';
const backups = [
{ date: 'Today, 03:10', description: 'Automatic' },
{ date: 'Yesterday, 03:10', description: 'Automatic' },
{ date: 'Yesterday, 22:05', description: 'Before the update' }
];
</script>
<div class="w-full max-w-[342px]">
<BackupsCard
title="Recent backups"
description="Every night, automatically. Restoring takes about two minutes."
{backups}
allHref="#backups"
allLabel="All 30 backups"
/>
</div>Custom row action
Use the rowAction snippet to replace the restore button, for example to open the restore dialog with the backup preselected.
<script lang="ts">
import { BackupsCard } from '@statix/ui/backups-card';
import { Button } from '@statix/ui/button';
import EyeIcon from '@lucide/svelte/icons/eye';
const backups = [
{ id: 'a', date: 'Today, 03:10', description: 'Automatic', size: '2.4 GB' },
{
id: 'b',
date: 'Yesterday, 22:05',
description: 'Before the WordPress update',
size: '2.4 GB'
}
];
</script>
<div class="w-full max-w-[728px]">
<BackupsCard title="Restore points" {backups}>
{#snippet rowAction(backup)}
<Button
variant="ghost"
size="icon-sm"
href="#preview-{backup.id}"
aria-label="Preview {backup.date}"
>
<EyeIcon />
</Button>
<Button variant="outline" size="sm" href="#restore-{backup.id}">Restore</Button>
{/snippet}
</BackupsCard>
</div>Guidelines
Do
- Show three or four backups, newest first.
- Say how restoring works in the description: how long it takes and that we back up the current state first.
- Name the reason for manual backups: "Before the WordPress update".
Don't
- Don’t restore directly from the button. Open a confirmation dialog first.
- Don’t shorten dates to numbers only. "Yesterday, 22:05" reads faster than "17.11. 22:05".
Accessibility
- Backups render as a <ul>. Each date is a <time> element.
- All restore buttons share one label; each one points to its date with aria-describedby, so screen readers hear "Restore, Yesterday, 03:10".
- Only one of the two "all backups" links is visible at a time; the hidden one is removed from the accessibility tree.
API reference
BackupsCard
renders<div> (Card) and accepts its attributes| Prop | Type | Default |
|---|---|---|
title * | string Card heading. | – |
description | string How backups work. | – |
backups * | { id?: string; date: string; datetime?: string; description?: string; size?: string }[] Backups, newest first. | – |
restoreLabel | string Label of each restore button. | 'Restore' |
onrestore | (backup: BackupsCardItem) => void Called when a restore button is pressed. | – |
allHref | string Link to the full backup list. | – |
allLabel | string Label of that link. Both are needed. | – |
headingLevel | 2 | 3 | 4 Heading level of the title. | 3 |
rowAction | Snippet<[BackupsCardItem]> Replaces the restore button. | – |
ref bind | HTMLDivElement | null The root element. | – |
class | ClassValue Merged with the card classes; yours win. | – |
| Data attribute | Meaning |
|---|---|
data-slot="backups-card" | Root. Parts use backups-card-header, -title, -description, -list, -row. |