Components
Not found and forbidden
What an address no page answers and a page the reader may not open say, inside the app's frame: the menu stays, one sentence stands where the page would have. Not one of Flux UI's components: the kit's own, drawn as Flux's warning and danger callouts and worded from the RaskStrings catalog — a Hungarian reader reads „A kért oldal nem található.” and „Nincs jogosultsága az oldal megtekintéséhez.”
Not found
An app on the kit draws this by itself at an address no page answers, inside its root layout — the route at / its pages nest under — and answers 404. It needs no not-found page of its own; one it declares with [NotFound] still wins, and can draw Ui.NotFound. Home(route) is where the button leads.
namespace Rask.Site.Features.UiDocs.Examples;
// What an address no page answers says, where the page would have been: one sentence, and the way home.
public sealed partial class NotFoundExample : Component
{
protected override Component? Render() =>
Ui.NotFound.Home(Routes.UiIntroductionPage());
}Forbidden
A page whose [Authorize] turns a signed-in reader away shows this in its layout's outlet by itself. A page that decides for itself draws it in place of its content: !allowed ? Ui.Forbidden : …. A refused save says the same sentence in its toast: RaskStrings.Get(RaskString.PageForbidden, …).
namespace Rask.Site.Features.UiDocs.Examples;
// A page that decides for itself who may see it draws Ui.Forbidden in place of its content.
public sealed partial class ForbiddenExample : Component
{
private bool _admin;
protected override Component? Render() =>
Div.Class("space-y-4")[
Ui.Field.Variant(Ui.FieldVariant.Inline)[
Ui.Label["Signed in as an administrator"],
Ui.Switch.Value(_admin).OnChange(on => { _admin = on; }).Id("uf-admin"),
Ui.Error
],
_admin ? Ui.Text.Id("uf-records")["Three suppliers, 412 deliveries."] : Ui.Forbidden
];
}Reference
Ui.NotFound
What an address no page answers says: a warning callout with the catalog's sentence and a small button home. The built-in 404 with the kit on.
Step | Takes | What it does |
|---|---|---|
.Home(…) | a route: Routes.DashboardPage() | Where the button leads. The root, /, when unset. |
Ui.Forbidden
What a page says to a signed-in reader whose account may not open it: a danger callout, an alert, with the catalog's sentence. The built-in 403 with the kit on.
No steps of its own: what goes inside it is its content.