Widget
One widget, drawn on the one widget tile (`WidgetTile`). Reads through the data provider in the viewer's scope (ViewerScope), under row security, and keeps itself current (`live`, default on). Hidden when the viewer can't read a field it totals or the widget's `can` says no. ```tsx <DashboardPage title="Sales" stats={<><Widget widget={openDeals} /><Widget widget={pipeline} /></>} /> ```
packages/ui/src/components/data/widget/Widget.tsx
@marktiderman/genesis-ui/dataimport { Widget } from "@marktiderman/genesis-ui/data";react-docgen-typescript.Widget
One widget, drawn on the one widget tile (`WidgetTile`). Reads through the data provider in the viewer's scope (ViewerScope), under row security, and keeps itself current (`live`, default on). Hidden when the viewer can't read a field it totals or the widget's `can` says no. ```tsx <DashboardPage title="Sales" stats={<><Widget widget={openDeals} /><Widget widget={pipeline} /></>} /> ```
| Prop | Type | Default | Description |
|---|---|---|---|
| widget* | DefinedWidget | WidgetDefinition | — | From `defineWidget`. |
| className | string | — | |
| icon | ReactNode | — | An icon beside the label. |
| linkComponent | LinkComponent | ({ href, children, testID, ...rest }) => ( <a href={href} data-testid={testID} {...rest}> {children} </a> ) | Router link for `href` and `rowHref`. Default a plain `<a>`. |
| locale | string | — | Number locale (`Intl`). Default the runtime's. |
| refused | ((reason: string) => ReactNode) | — | Shown in place of the tile when the viewer may not see it. Default nothing. |
| rowHref | ((row: Record<string, unknown>) => string) | — | A list widget's link for one row (its record page). |