# Limit notice

A limit reached in plain words: its name, cap, lift time and contest path, inline under a control or as a whole-page state.

Live variants: https://design.arcadia.is/components/limit-notice

```tsx
import { LimitNotice } from "@arcadia/ui";
```

Calm day: inviting people reaches the cap, and the notice stands right under the invite control.

```tsx
import { useState } from "react";
import { Button, Field, Input, LimitNotice } from "@arcadia/ui";

function InviteInline() {
  const [email, setEmail] = useState("sam@example.com");
  const [hit, setHit] = useState(false);
  const [contested, setContested] = useState(false);
  const invite = (e: FormEvent) => {
    e.preventDefault();
    setHit(true);
  };
  return (
    <form onSubmit={invite} {...sx("limit-invite-form", page.form)}>
      <div {...sx("limit-invite-row", page.row)}>
        <div {...sx("limit-invite-field", page.field)}>
          <Field label="Invite by email">
            <Input
              type="email"
              inputMode="email"
              spellCheck={false}
              autoCapitalize="none"
              placeholder="name@example.com"
              value={email}
              onValueChange={setEmail}
            />
          </Field>
        </div>
        <Button type="submit" size="md" density="compact" variant="primary">Send invitation</Button>
      </div>
      {hit && (
        <LimitNotice
          name="Invitations to strangers"
          count="5 of 5"
          cap="5 in 24 hours"
          lifts="In 14h 20m"
          contested={contested}
          onContest={() => setContested(true)}
        />
      )}
    </form>
  );
}
```

## Accessibility

In `inline` layout the notice carries `role="status"` so screen readers announce it politely when a submission hits the limit. In `page` layout with `fill` it renders `main` with an `h1`. The count, cap and lift time stand inside a `dl` (`Facts`) with tabular digits, and Contest is a real anchor (`contestHref`) or native button (`onContest`).

- Tab: Move from the control to the Contest button or link
- Enter: Activate Contest
- Space: Activate Contest when rendered as a button

## API reference

### LimitNotice

- `nesting` (`"contained-object"`): Mark a separately framed inline notice contained in another surface.
- `name` (`ReactNode`, required): The limit's name in plain words ("Invitations to strangers", "Checkout starts").
- `cap` (`ReactNode`, required): The cap in words ("5 in 24 hours", "3 a day", "0 while narrow").
- `lifts` (`ReactNode`, required): When the limit lifts ("In 14h 20m", "Nov 21, 09:00").
- `count` (`ReactNode`): Optional count reached ("5 of 5", "10 today"). Omitted when absent.
- `description` (`ReactNode`): Optional one-line detail. Defaults to `"You reached this limit."` in `"page"` layout; pass `false` to omit.
- `contestHref` (`string`): Address to contest the limit; renders Contest as a link.
- `onContest` (`() => void`): Starts contesting in place; renders Contest as a button.
- `contestLabel` (`ReactNode`, default `"Contest"`): Label for the contest control.
- `contesting` (`boolean`, default `false`): Keeps the Contest button busy while a contest is being sent.
- `contested` (`boolean | ReactNode`, default `false`): Already contested: replaces Contest with a quiet status line (`true` or custom text).
- `contestNote` (`ReactNode`): Plain words on how to contest (for example a contact address on a signed-out screen).
- `layout` (`"inline" | "page"`, default `"inline"`): `"inline"`: compact notice under the control that met it. `"page"`: whole-page state.
- `brand` (`string | false`, default `"Arcadia"`): Accessible name for the Arcadia mark in `"page"` layout, or `false` to omit it.
- `align` (`"center" | "start"`, default `"start"`): `start`: the page state's column read from its start edge, at `--app-settings-width`. `center`: the same column and its words centred, at `--home-width`, as NotFoundPage draws it.
- `fill` (`boolean`, default `true`): In `"page"` layout: fill the viewport as `main` on `--bg-app`. Set `false` inside an existing frame.
- `rootStyle` (`RootStyle`): Typed StyleX override: layout.

Rest props go to `HTMLAttributes<HTMLElement>`.
