195 Pro components and page blocks

Get Pro

Updated

Sync Button

New

Preview

Customize

Duration1.6s
Success colour
Error colour
Medium

Installation

npx shadcn@latest add https://uibrik.com/r/sync-button.json
Adds the files to components/uibrik/sync-button and installs motion and react-use-measure. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/sync-button.

Usage

import { SyncButton } from "@/components/uibrik/sync-button/sync-button";​<SyncButton  duration={1.6}  label="Sync now"  syncingLabel="Syncing"  syncedLabel="Synced"  successColor="#16a34a"  errorColor="#dc2626"  size="md"  errorLabel="Couldn't sync"  onSync={() => {}}  // defaultLastSynced={…}/>

Where to use Sync Button

  • Integrations and data sources

    The time since the last sync stays current, so people know whether the numbers are fresh.

    Pairs with MCP Connectors and Integration Box

  • Dashboards with manual refresh

    Arrows that coast to a stop make a fast refresh still feel like it did something.

    Pairs with Revenue Dashboard

  • Offline-first apps

    Pass the real sync as a promise; a failure shakes the button and says so in red.

    Pairs with Offline Plug

Props

SyncButton
duration
Type number
1.6
How long a simulated sync takes.
label
Type string
"Sync now"
Label before the first sync.
syncingLabel
Type string
"Syncing"
Label while it works.
syncedLabel
Type string
"Synced"
Prefix for the time since the last sync.
successColor
Type string
"#16a34a"
Colour of the check.
errorColor
Type string
"#dc2626"
Colour of the error state.
size
Type "sm" | "md" | "lg"
"md"
Height, padding and text size.
onSync
Type () => Promise<unknown> | void
–
Runs the sync. A returned promise keeps it spinning until it settles; a rejection shows the error.
defaultLastSynced
Type Date | number
–
When the last sync happened, on mount.
errorLabel
Type string
"Couldn't sync"
Label after a failed sync.
className
Type string
–
Classes for the wrapper.