Quota field
v0.64.0, changelogBetaA limit that may be unlimited: a switch for Unlimited (`null`) and a number for any limit, 0 included, so a cleared box never has to guess which was meant.
Limit
Install
npx shadcn add @syncrobotic/quota-field Also installs: lucide-react@^1, @syncrobotic/cn, @syncrobotic/format-number, @syncrobotic/choice-field, @syncrobotic/number-field, @syncrobotic/switch
Overview
When to use
- A project's device seats, a plan's seat count, any limit that may be unlimited.
Use something else
- A number that is never unlimited: Number field.
- A choice of a set, not a count: All or some field.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Unlimited
Zero
Over
Zh tw
Usage rules
- Unlimited is
nulland 0 is a limit of none: the switch says which, and an emptied box never becomes either. - Give
usedfrom the server so the limit reads against what is in use; a limit below it warns, and nothing is taken away. - Show a saved quota with
formatQuota, so a list says Unlimited where the server says null.
Changelog
- 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
- 0.57.02026-11-27First release: Unlimited is a switch (
null), any limit a NumberField (0 included, never read as unlimited), the last number kept across the switch, usage against the limit (used) and a warning when it is above it;formatQuota.