DocsComponentsButton link
Button link
A link styled as a button.
1 file
<div class="flex gap-2">
<pb-ui.button-link href="#">Get started</pb-ui.button-link>
<pb-ui.button-link href="#" variant="secondary">Documentation</pb-ui.button-link>
<pb-ui.button-link href="#" variant="link">Learn more</pb-ui.button-link>
</div>Installation
pyblade-ui add button-link- Copy this file into your projectcomponents/ui/button_link.html
@props({'variant': 'default', 'size': 'default', 'href': '#'}) <a href="{{ href }}" data-slot="button" {{ attributes.cn( "inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { 'default': 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90', 'destructive': 'bg-destructive text-white shadow-xs hover:bg-destructive/90 dark:bg-destructive/60', 'outline': 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50', 'secondary': 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80', 'ghost': 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50', 'link': 'text-primary underline-offset-4 hover:underline', }[variant], { 'default': 'h-9 px-4 py-2 has-[>svg]:px-3', 'sm': 'h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5', 'lg': 'h-10 rounded-md px-6 has-[>svg]:px-4', 'icon': 'size-9', }[size], ) }}>{{ slot }}</a> - Update the path to fit your project
The
componentsfolder is the one set inpyblade.toml.
Usage
The tag <pb-ui.button-link> is available in all your templates.
<pb-ui.button-link href="/docs" variant="secondary">Docs</pb-ui.button-link>Props
| Prop | Default |
|---|---|
| variant | 'default' |
| size | 'default' |
| href | '#' |
Any other attribute (class, id, x-on:click, hx-post…) is passed to the root element; your Tailwind classes win over the component's.