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: "time" | "true" | "false" | "page" | "step" | "location" | "date"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: boolean | 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: booleanDefaultcomponents.BbButton.disableAutoLoading, else false | Disables the spinners the button starts on its own (an async click handler's, a submit button's while its 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 | { url: string; method: "get" | "post" | "put" | "patch" | "delete"; } | The link target: renders an anchor (an Inertia Use for a destination, not an action. The rendered link keeps browser navigation behaviour. See example |
iconOnly Type: Responsive<boolean> | Shows only the button's icon ( Keep writing the label: it becomes the visually hidden accessible name. An icon-only button without a label 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: (PtCompoundOf<"", { readonly parts: readonly ["root", "icon", "spinner", "text"]; readonly states: readonly ["activeLink", "exactActiveLink", "pressed", "disabled", "loading"]; readonly wide: readonly ["activeLink", "exactActiveLink", "pressed", "disabled", "loading"]; readonly variant: { readonly names: readonly ["primary", "outline", "secondary", "ghost", "destructive", "link"]; readonly option: "buttonVariants"; }; }> & PtMap<BbButtonPtPart, "link" | "disabled" | "outline" | "primary" | "destructive" | "loading" | "activeLink" | "exactActiveLink" | "secondary" | "pressed" | "ghost">) | 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>Defaultcomponents.BbButton.size, else '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 | et | X | 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" | "reset" | "submit" | Gets the classification and default behavior of the button. Defaults to |
variant Type: ButtonVariantTypeDefaultcomponents.BbButton.variant, else 'primary' | Visual variant: 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 |
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 silentlyiconprepend:iconfails silentlyAn icon-only button:
prepend:icon="…" icon-only, and write the label (the slot ortext): it stays the accessible name.- slot
iconprepend:iconfails silentlyAn icon-only button:
#prepend:iconwithicon-only. themeremovedfails silentlytooltipremovedfails silentlytooltipPlacementremovedfails silentlytooltipTimeoutremovedfails silently