Button Back

Smart back button. Uses browser history when available, otherwise navigates to a fallback destination derived from the current path. Bound to the B keyboard shortcut by default.

Default

Renders an arrow + Back label. Pressing B triggers it.

Dark previewReplay previewOpen in new tab

Usage

Import the parts you need from the component's folder.

ts
import { ButtonBack } from "@/components/ui/button-back";

Variants

default for inline use, bordered for floating buttons, semiTransparent for over-image headers.

Dark previewReplay previewOpen in new tab

Custom trigger

Use the default scoped slot to render your own UI while keeping the navigation behaviour.

Dark previewReplay previewOpen in new tab

API Reference

ButtonBack

PropTypeDefaultDescription
destinationstringnullFallback path when history is empty. Falls back to the parent path when null.
showLabelbooleantrueShow or hide the Back label.
forceDestinationbooleanfalseAlways navigate to destination, ignoring history.
variant"default" | "bordered" | "semiTransparent""default"Visual style.
shortcutbooleantrueEnable the B keyboard shortcut.
SlotDescription
defaultScoped slot receives goBack handler for fully custom triggers.