<a>) element styled as a Bootstrap button, perfect for navigation actions that should look like buttons.
Basic Usage
Attributes
The URL for the link’s
href attribute. Can be a relative or absolute URL.Leave empty to create a button-styled link without a destination (useful when setting href dynamically).The Bootstrap button color variant. Available options:
primary- Primary brand colorsecondary- Secondary colorsuccess- Success state (green)danger- Danger/delete actions (red)warning- Warning state (yellow)info- Informational (blue)light- Light backgrounddark- Dark backgroundlink- Link-styled appearance
btn-{color} class.Examples
Basic Navigation
Color Variants
With Icons
External Links
Dynamic URLs
With Additional Attributes
Action Buttons Group
Cancel Button in Forms
Implementation Details
The LinkButton component:- Renders an
<a>element with Bootstrap’sbtnandbtn-{color}classes - Supports all standard anchor attributes (target, rel, download, etc.)
- URL is rendered as the
hrefattribute when provided - Allows attribute merging for custom classes and other HTML attributes
- Provides the visual appearance of a button with link functionality
- Navigation actions that should look like buttons
- Cancel buttons in forms (to navigate away)
- Primary call-to-action links
- Action links in button groups
- Form submissions (use
<x-forms::submit>) - JavaScript-triggered actions without navigation
- Actual form control buttons (reset, etc.)
/src/Views/Components/LinkButton.php:17