BackButton
The link back from a record to its list.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/back-button.jsonHeader row of a detail page
Semua karyawan
Karyawan 1 dari 48
When to use
- The top left of a detail page, to go back to its list: "‹ Semua karyawan" (Karyawan · Detail).
- Once per page, in the header row, with the record position and prev / next on the right.
When not to use
- Any other navigation (a card footer, a row) → ListRow nav or CardFooterLink (dark text + grey chevron).
- Going between top-level pages → the rail.
- An action (save, open a panel) → Button.
Do and don't
Say where it goes"Semua karyawan", the list's name. The user knows the target before the click.
"Kembali" or a Button with router.back()"Kembali" hides the target, and history.back() can leave the app when the page was opened from a link. Always an href to the list.
Installation
Add BackButton with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.
API
import { BackButton } from "@/components/mahr/back-button"| Prop | Type | Default | Description |
|---|---|---|---|
href | string | – | The list URL. Keep its query (tab, search, page) so the user returns to the same place. |
render | ReactElement | – | Your router link: render={<Link href="/karyawan" />}. |
children | string | – | "Semua" + the list name. |