RefreshIconButton

A compact icon-only button that refreshes the current view's data. Wraps the icon in a tooltip with the localized label.

Installation

pnpm dlx shadcn@latest add @shadmin/refresh-icon-button

Usage

import { RefreshIconButton } from "@/components/admin";
 
const MyAppBar = () => (
  <header>
    <RefreshIconButton />
  </header>
);

On click, calls useRefresh() from ra-core, which invalidates the cache for all visible queries and triggers a re-fetch.

For a full text button, use <RefreshButton> instead.

Props

PropRequiredTypeDefaultDescription
classNameOptionalstring-Additional classes
iconOptionalReactNodeRefreshCw iconCustom icon element
labelOptionalstringra.action.refreshTooltip and aria-label
onClickOptional(e: MouseEvent<HTMLButtonElement>) => void-Additional click handler

icon

Replaces the default <RefreshCw /> shown in the button. Pass any lucide-react icon to convey a different action.

import { RefreshCcw } from "lucide-react";
import { RefreshIconButton } from "@/components/admin";
 
<RefreshIconButton icon={<RefreshCcw />} />;

label

By default, the label is the translation of the ra.action.refresh key, which reads "Refresh". Pass a custom string or translation key to override:

<RefreshIconButton label="Reload data" />