Button

Displays a button.

Component Code
{% import "april::ui" as april %}
{% call april.button() %}
Button
{% endcall %}

Button Link

The examples below also work with the button link component, which just uses an a tag under the hood

Component Code
{% import "april::ui" as april %}
{% call april.button_link(attrs={"href": "https://x.com/yungifez"}) %}
Button
{% endcall %}

Variant examples

The button component comes in multiple variants

Default

Component Code
{% import "april::ui" as april %}
{% call april.button() %}
Button
{% endcall %}

Secondary

Component Code
{% import "april::ui" as april %}
{% call april.button(variant="secondary") %}
Button
{% endcall %}

Destructive

Component Code
{% import "april::ui" as april %}
{% call april.button(variant="destructive") %}
Button
{% endcall %}

Outline

Component Code
{% import "april::ui" as april %}
{% call april.button(variant="outline") %}
Button
{% endcall %}

Ghost

Component Code
{% import "april::ui" as april %}
{% call april.button(variant="ghost") %}
Button
{% endcall %}

Link

Component Code
{% import "april::ui" as april %}
{% call april.button(variant="link") %}
Button
{% endcall %}

You can also use the none variant and style the button yourself

Size examples

The button component comes in multiple sizes


Default

Component Code
{% import "april::ui" as april %}
{% call april.button() %}
Button
{% endcall %}

Icon

Component Code
{% import "april::ui" as april %}
{% call april.button(size="icon", variant="outline", attrs={"class": "justify-center"}) %}
<svg class="{{ "size-4" }}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  <path d="m9 18 6-6-6-6"/>
</svg>
{% endcall %}

Small

Component Code
{% import "april::ui" as april %}
{% call april.button(size="sm") %}
Button
{% endcall %}

Large

Component Code
{% import "april::ui" as april %}
{% call april.button(size="lg", variant="outline") %}
<svg class="{{ "mr-2 size-4" }}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  <path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/>
  <rect x="2" y="4" width="20" height="16" rx="2"/>
</svg>
    Login with Email
{% endcall %}

Overriding styles

A class you pass replaces the class it conflicts with, rather than sitting next to it. size="icon" class="h-7 w-7" gives you a 7 by 7 button, not a fight between two heights.

{% import "april::ui" as april %}
{% call april.button(size="icon", attrs={"class": "h-7 w-7"}) %}
...
{% endcall %}

Overriding Views

Copy a component template into resources/views/vendor/april to override the embedded package view. Keep only the overrides your application needs.