Skip to content
weftGitHub

RateLimited

Says a limit was reached and holds the button until the wait is over.

SourcePackage @weft-js/warp

Preview

tsx
import { RateLimited } from '@weft-js/warp'export function Export() {  return (    <RateLimited retryAfter={12} title="Export limit reached." description="You can run 5 exports a minute." trigger={EXPORT_BUTTON} />  )}const EXPORT_BUTTON = { children: 'Export CSV', emphasis: 'outline', tone: 'neutral' } as const

Installation

npm install @weft-js/warp

Usage

tsx
import { RateLimited } from '@weft-js/warp'<RateLimited retryAfter={12} title="Export limit reached." description="You can run 5 exports a minute." trigger={EXPORT_BUTTON} />

Accessibility

  • This has no shortcuts of its own: controls inside it use Tab, Enter and Space as usual, and warp's parts keep their roles and labels.

API Reference

PropTypeDefaultDescription
retryAfternumber—Seconds, from the typed RATE_LIMITED.retryAfter: never a guess.
titleunknown'Limit reached.'The heading.
descriptionunknown—"You can run 5 exports a minute."
triggerButtonProps—The action that hit the limit: disabled, labelled "Try again in 20s", and back by itself.
EventTypeDefaultDescription
onDone(() => void)—Called when the wait is over and the action is back.

Parts

Every element carries a stable name, so you can style it from your own CSS: [data-scope="stack"] [data-part="msg"]

msgrailrail-fill

RelatedConn bannerAudit log