+++ title = "Button" description = "Add colorful buttons to forms and pages." categories = ["experience"] tags = ["controls"] html_attributes = ["id", "value", "name", "class", "onclick", "tabindex", "target", "disabled", "form"] custom_attributes = ["type", "text", "isghost", "isblock", "action", "method"] snippets_used = ["button", "button group", "throbber", "form", "external"] [[copyright]] owner = "Josh Habdas" date = "2019" license = "agpl-3.0-or-later" +++ Different types: ```html {{}} {{}} {{}} {{}} {{}} {{}} ``` {{< hackcss-button text="Default" />}} {{< hackcss-button text="Primary" type="primary" />}} {{< hackcss-button text="Success" type="success" />}} {{< hackcss-button text="Info" type="info" />}} {{< hackcss-button text="Warning" type="warning" />}} {{< hackcss-button text="Error" type="error" />}} Ghost types: ```html {{}} {{}} {{}} {{}} {{}} {{}} ``` {{< hackcss-button isghost="true" text="Default" />}} {{< hackcss-button isghost="true" text="Primary" type="primary" />}} {{< hackcss-button isghost="true" text="Success" type="success" />}} {{< hackcss-button isghost="true" text="Info" type="info" />}} {{< hackcss-button isghost="true" text="Warning" type="warning" />}} {{< hackcss-button isghost="true" text="Error" type="error" />}} Block-level: ```html {{}} ``` {{< hackcss-button type="primary" isghost="true" isblock="true" text="Block Level Button" />}} Text in body: ```html {{}}Default{{< /hackcss-button */>}} {{}}HTML{{< /hackcss-button */>}} {{%/* hackcss-button type="success" %}}~~Markdown~~{{% /hackcss-button */%}} {{}}Hidden comment{{< /hackcss-button */>}} ``` {{< hackcss-button >}}Default{{< /hackcss-button >}} {{< hackcss-button type="primary" >}}HTML{{< /hackcss-button >}} {{% hackcss-button type="success" %}}~~Markdown~~{{% /hackcss-button %}} {{< hackcss-button isghost="true" text="Comment" >}}Hidden comment{{< /hackcss-button >}} In [Button Group](../button-group): ```html {{}} {{< hackcss-button isghost="true" type="success" text="Left" >}} {{< hackcss-button isghost="true" type="success" text="Middle" >}} {{< hackcss-button isghost="true" type="success" text="Right" >}} {{< /hackcss-buttongroup */>}} ``` {{< hackcss-buttongroup >}} {{< hackcss-button isghost="true" type="success" text="Left" />}} {{< hackcss-button isghost="true" type="success" text="Middle" />}} {{< hackcss-button isghost="true" type="success" text="Right" />}} {{< /hackcss-buttongroup >}} Print preview: ```html {{}} {{< /hackcss-button */>}} ``` {{< hackcss-button type="info" isghost="true" onclick="print()" >}} {{< /hackcss-button >}} [Loading](../throbber) indication: ```html {{}} Loading… {{< hackcss-throbber >}} {{< /hackcss-button */>}} ``` {{< hackcss-button type="info" isghost="true" >}} Loading… {{< hackcss-throbber >}} {{< /hackcss-button >}} [External](../external) navigation: ```html {{}} {{< hackcss-button type="success" text="Open" />}} {{< /external */>}} ``` {{< external rel="shortlink" href="https://go.habd.as/mavic-air" >}} {{< hackcss-button type="success" text="Open" />}} {{< /external >}} [Form](../form) control: ```html {{}} {{< hackcss-buttongroup formactions="true" >}} {{< hackcss-button text="Custom Action" action="javascript:alert('Custom Alert')" isghost="true" type="primary" />}} {{< hackcss-button disabled="true" isghost="true" text="Disabled" />}} {{< /hackcss-buttongroup >}} {{< /hackcss-form */>}} ``` {{< hackcss-form action="javascript:alert('Form Alert')" >}} {{< hackcss-buttongroup formactions="true" >}} {{< hackcss-button text="Custom Action" action="javascript:alert('Custom Alert')" isghost="true" type="primary" />}} {{< hackcss-button disabled="true" isghost="true" text="Disabled" />}} {{< /hackcss-buttongroup >}} {{< /hackcss-form >}} ```html {{}} {{}} ``` {{< hackcss-form id="owner" action="javascript:alert('Form Alert')" />}} {{< hackcss-button form="owner" text="Form Action" type="primary" isghost="true" />}}