Props
| Name | Description |
|---|---|
activeClass Type: string | Class to apply when the link is active. |
append:icon Type: string | Icon to be added on the right of the text. See example |
ariaCurrentValue Type: "page" | "step" | "location" | "date" | "time" | "true" | "false"Default'page' | Value passed to the attribute |
async Type: booleanDefaultfalse | Inertia: runs the visit without blocking — the page stays interactive and several async visits can be in flight at once. |
block Type: booleanDefaultfalse | Displays the component as full width. See example |
cacheFor Type: string | number | (string | number)[] | Inertia: how long a prefetched response stays fresh before it is re-fetched. A single duration, or |
cacheTags Type: string | string[] | Inertia: tags to file this visit's prefetch cache under, so a later request can invalidate the whole tagged group. |
component Type: string | Inertia: the page component this visit resolves to. Rarely set by hand — the server normally decides it. |
data Type: object | Request payload forwarded to Inertia when navigating via |
disableAutoLoading Type: booleanDefaultfalse | Disables every spinner the button starts on its own: the one that tracks an async click handler, and a Use only when an async click should intentionally remain interactive without automatic pending state. See example |
disabled Type: booleanDefaultfalse | Disables the component: native |
download Type: string | boolean | Marks an |
exactActiveClass Type: string | Class to apply when the link is exact active. |
except Type: string[] | Inertia: the inverse of |
external Type: booleanDefaultfalse | Forces an |
falseValue Type: anyDefaultfalse | Value emitted when the toggle is deactivated. See example |
group Type: booleanDefaultfalse | Identifies the button as part of a button group: adjacent |
headers Type: object | Additional HTTP headers forwarded to Inertia when navigating via |
href Type: string | Returns the hyperlink's URL. Can be set, to change the URL. Use for a destination, not an action. The rendered link keeps browser navigation behaviour. See example |
icon Type: string | Used when only an icon with no text should be displayed. Slot content becomes the visually hidden accessible name. An icon-only button without slot text or an explicit |
instant Type: booleanDefaultfalse | Inertia: navigate optimistically on click and reconcile when the response lands, instead of waiting for the round trip. |
interactiveWhileLoading Type: booleanDefaultfalse | Keeps the button clickable while it is loading. Buttons are disabled while loading by default; this escape hatch exists for toggles that must stay interactive (e.g. the dropdown-button caret). |
loading Type: booleanDefaultfalse | Triggers a loading indicator. A loading button is soft-disabled on its own ( Bind this when pending state is owned outside the click handler, such as a form or store request. See example |
method Type: "get" | "post" | "put" | "patch" | "delete" | HTTP method used for Inertia navigation when Only with |
modelValue Type: any | Makes the button a toggle: clicking flips the model between |
onBefore Type: (() => void) | Lifecycle hook invoked by Inertia right before the request is sent. |
onCancel Type: (() => void) | Lifecycle hook invoked by Inertia when a request is cancelled. |
onCancelToken Type: ((cancelToken: unknown) => void) | Receives the Inertia cancel token source when a request is initiated. Can be used to cancel the request.
Typed platform-agnostically (matching BbButton) so the library's types never require |
onError Type: ((errors: Record<string, string>) => void) | Inertia's hook for a VALIDATION error answer (the 422 path): the only failure callback |
onFinish Type: (() => void) | Lifecycle hook invoked by Inertia after the request has finished (regardless of success or error). |
only Type: string[] | Limits the properties that are preserved in Inertia partial reloads. |
onPrefetched Type: (() => void) | Lifecycle hook invoked by Inertia when a prefetch for this link has completed and is cached. |
onPrefetching Type: (() => void) | Lifecycle hook invoked by Inertia when a prefetch for this link starts. |
onProgress Type: ((progress: { percentage: number | undefined; }) => void) | Progress callback invoked by Inertia with the upload/download percentage when available. |
onStart Type: (() => void) | Lifecycle hook invoked by Inertia when a request starts. |
onSuccess Type: (() => void) | Lifecycle hook invoked by Inertia when a request succeeds. |
pageProps Type: Record<string, unknown> | ((currentProps: Record<string, unknown>, sharedProps: Record<string, unknown>) => Record<string, unknown>) | null | Inertia: props to merge into the next page optimistically, before the server responds. Either an object or a function of the current props.
Typed platform-agnostically (matching BbButton) so the library's types never require |
prefetch Type: string | boolean | string[] | Inertia: fetch and cache this link's page ahead of the click. |
prepend:icon Type: string | Icon to be added on the left of the text. See example |
preserveScroll Type: boolean | ((props: Record<string, unknown>) => boolean)Defaultfalse | Controls whether Inertia should preserve the current scroll position after navigation. Can be a boolean or a predicate receiving the visit props. |
preserveState Type: boolean | ((props: Record<string, unknown>) => boolean) | nullDefaultfalse | Controls whether Inertia should preserve the current state after navigation. Can be a boolean or a predicate receiving the visit props. |
preserveUrl Type: booleanDefaultfalse | Inertia: keep the current URL in the address bar even though the page content changes. |
pt Type: PtMap<BbButtonPtPart, "outline" | "primary" | "destructive" | "activeLink" | "exactActiveLink" | "loading" | "secondary" | "disabled" | "pressed" | "ghost" | "link"> | Passthrough, object form: |
pt:<part> Type: PtValue | Passthrough, attribute form: one attribute per part, |
queryStringArrayFormat Type: "brackets" | "indices"Default'brackets' | Format to use when serializing array values into the query string for Inertia requests. |
replace Type: booleanDefaultfalse | Calls |
size Type: Responsive<Sizes>Default"md" | Sets the size of the button. A single value applies at every breakpoint; a per-breakpoint map (e.g. |
tag Type: ButtonTagDefault'button' | Element to render for the plain (non-link, non-router) button: |
target Type: string | Sets or retrieves the window or frame at which to target content. See example |
text Type: string | Text content of the component. |
to Type: string | wt | bt | Route Location the link should navigate to when clicked on. Use for internal Vue Router or Nuxt navigation instead of calling the router from |
trueValue Type: anyDefaulttrue | Value emitted when the toggle is activated. See example |
type Type: "button" | "submit" | "reset" | Gets the classification and default behavior of the button. Defaults to |
variant Type: ButtonVariantTypeDefault"primary" | Visual variant of the button: colours and surface only, never spacing or size. Choose by hierarchy, not colour. Register recurring project variants; use |
viewTransition Type: booleanDefaultfalse | Inertia: run the page swap inside a View Transition, where the browser supports one. |
v-model
Values kept in sync through v-model.
| Name | Description |
|---|---|
modelValue Type: any | Binding it is what makes the button a toggle, with |
Events
| Name | Description |
|---|---|
update:modelValue Type: (value: any): void | Emitted with the new value whenever |
Slots
The listed properties are the ones exposed to the slot scope.
| Name | Description |
|---|---|
append:icon Type: BbButtonIconSlotProps | The trailing icon, replacing |
default Type: BbLinkSlotProps | Primary content rendered inside the button. Falls back to the The visible label, or the accessible name when |
icon Type: BbButtonIconSlotProps | The icon of an icon-only button, replacing the |
prepend:icon Type: BbButtonIconSlotProps | The leading icon, replacing |
Exposed methods
| Name | Description |
|---|---|
$el Type: HTMLElement |
Renamed and removed
Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.
enabledWhileLoadinginteractiveWhileLoadingfails silentlythemeremovedfails silentlytooltipremovedfails silentlytooltipPlacementremovedfails silentlytooltipTimeoutremovedfails silently