App patterns
AttentionList
The items that need a person, for example open alerts. Each row has the level, the title as a link, the area, the age and one next action; the app sorts the items. compact is the short form for a popover. An item without href has a plain title and no link.
import { AttentionList, type AttentionItem } from "@percentsa/ui";Examples
- Critical
- ImportantDeploy failed
shop.example.com
- ImportantDisk almost full
Main website
- OtherUpdate ready
203.0.113.10
Code
export function AttentionListExample() {
const t = useT();
return (
<div className="w-full">
<AttentionList label={t("Open alerts", "التنبيهات المفتوحة")} items={useAttentionItems()} />
</div>
);
}
/** A bell button opens a popover with the short form: the first 4 of 7 items, then a link to the full list. */Code
export function AttentionListCompactExample() {
const t = useT();
return (
<Popover
trigger={
<Button variant="secondary" iconOnly aria-label={t("Open alerts", "التنبيهات المفتوحة")}>
<Bell aria-hidden />
</Button>
}
className="w-80"
>
<AttentionList compact label={t("Open alerts", "التنبيهات المفتوحة")} items={useAttentionItems()} />
<a href="#all" className="mt-2 block text-sm font-medium">
{t("Show all 7", "عرض الكل (7)")}
</a>
</Popover>
);
}
// The docs page has its own h1, so the examples use headingLevel={2}.
/** A list page: the title, a count, one primary action, Export and the "⋯" menu. Below 768 px "More actions" opens the rest. */