# Form Button

## Basic

#### Text

The text is displayed on the body of the button. It is recommended to use a short string for the text, as the button is used for triggering a command or action.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-cc0f6100036e58abbcd4789cafc72f70e2080330%2Fimage%20(236).png?alt=media" alt=""><figcaption></figcaption></figure>

## Interaction

#### Type

| Properties | Description                                                                                                            |
| ---------- | ---------------------------------------------------------------------------------------------------------------------- |
| `Default`  | Acts as a normal button, that triggers the specified action on the click event.                                        |
| `Submit`   | <p>Users will need to pick an existing form from the list and the button commands to submit the form selected.<br></p> |

`Default` and `Submit` types are explained in the sections below.

### Default

#### Event Handlers

<mark style="color:blue;">**`Click`**</mark> - This is triggered when this is used as a default button and the user clicks on it.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-10d7e996143043db710b8170f9d28197efd79027%2Fimage%20(188).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Disabled

Disables the user interaction with the element on the page. It visually indicates that the element is inactive and prevents users from interacting with it when applied.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-695f356d5e8bc58072102f50922157508eb6122b%2Fimage%20(224).png?alt=media" alt=""><figcaption><p>Read-only</p></figcaption></figure>

#### Hide

This sets whether the widget has to be displayed on the screen when the program is loaded. This shows/hides the widget both on desktop and mobile devices.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-4aaa812d0b623487c085a616219a4515138079fb%2Fimage%20(211).png?alt=media" alt="" width="338"><figcaption><p>Set the visibility</p></figcaption></figure>

#### Loading

It will be useful when there is a process to be carried out, like running a query to fetch data, before the widget is loaded. The `loading` boolean value can be utilized to show the spinner till the process is complete.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-c67f2b672db6a42ef8815bae1bc6c9fb4d5bea53%2Fimage%20(223).png?alt=media" alt=""><figcaption><p>Loading state</p></figcaption></figure>

#### Alignment

| Property                                                                                                                                                                                                                                                  | Layout                                                            |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| <img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2FG0Q2Gv2owo0DKYVs24mU%2Fimage.png?alt=media&#x26;token=ca2c44a4-a65c-4569-8f36-dea16760c77b" alt="" data-size="original"> | `Left` - The content is attached to the left side of the widget   |
| <img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2FQY7rdGT2B0V7bgsegR1Z%2Fimage.png?alt=media&#x26;token=37cac238-8502-4649-9447-2f9a19c68bf2" alt="" data-size="original"> | `Center` - The content is placed at the center part of the widget |
| <img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fphoe5s6qMs1eDZLzu5vt%2Fimage.png?alt=media&#x26;token=a08e3935-24bf-4fca-b783-88c4f006564c" alt="" data-size="original"> | `Right` - The content is attached to the right side of the widget |

### Submit

'Form to Submit' will show the list of forms and the user needs to choose one to attach to the widget.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-9aa286956478eebcf0885cbd9db3aa4c752cfb0e%2Fimage%20(239).png?alt=media" alt=""><figcaption></figcaption></figure>

Once the form has been linked, define the submit event. This will be triggered when the user clicks the button.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-cbeed9f0726b7d9380d0d5a3759da3ac5e3f7a07%2Fimage%20(176).png?alt=media" alt=""><figcaption></figcaption></figure>

## Layout

#### Prefix Icon

Choose one from the set of icons that will be displayed as a prefix logo, just before the button text.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-84b4467d72af31c0f88842ee9c3c2b32f29d733e%2Fimage%20(240).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Suffix Icon

Choose one from the set of icons that will be displayed as a suffix logo, just after the logo text.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-7c5824651045769416f99cb71539c6b5025434a2%2Fimage%20(241).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Tooltip

Tooltips display additional information upon mouse hover. This information will be contextual, useful, and informative. The tooltip will be immediately shown when the user's mouse hovers over the widget, and immediately hides when the user's mouse leaves.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-3b988047884926afedbbc802bcd488c0299a0f5f%2Fimage%20(244).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Placement

Refers to the position of the tooltip.

| Property    | Description                                                                        |
| ----------- | ---------------------------------------------------------------------------------- |
| top         | Tooltip is placed at the top of the widget                                         |
| left        | Tooltip is placed to the left side of the widget                                   |
| bottom      | Tooltip is placed at the bottom of the widget                                      |
| right       | Tooltip is placed to the right side of the widget                                  |
| topLeft     | Tooltip is placed at the top left corner of the widget                             |
| topRight    | Tooltip is placed at the top right corner of the widget                            |
| bottomLeft  | Tooltip is placed at the bottom left corner of the widget                          |
| bottomRight | Tooltip is placed at the bottom right corner of the widget                         |
| leftTop     | Tooltip is positioned primarily to the left and slightly above the target element  |
| leftBottom  | Tooltip positioned at the left bottom of its target                                |
| rightTop    | Tooltip is positioned primarily to the right and slightly above the target element |
| rightBottom | Tooltip positioned at the right bottom of its target                               |

#### Custom CSS

Users can write a specific style using CSS syntax here and the style text will be applied to the widget when the program is loaded.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-fa9e1a594d90201b6a93731c5462360bf0264480%2Fimage%20(243).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Height

|       |                                             |
| ----- | ------------------------------------------- |
| Auto  | The height is auto-adjusted for the content |
| Fixed | The height of the widget is fixed           |

## Style

<table><thead><tr><th width="218" align="center">Property</th><th>Description</th></tr></thead><tbody><tr><td align="center">Background</td><td>Users can change the colour of the text background using this property. It has all the RGB colour ranges to pick from. It is recommended to use a corresponding background colour that shows the font clearly.</td></tr><tr><td align="center">Hover Color</td><td>Refers to the specific color that is displayed when a user hovers their cursor over the widget.</td></tr><tr><td align="center">Hover Border Color</td><td>Refers to the color that is displayed on the border of the widget when a user hovers their cursor.</td></tr><tr><td align="center">Box Shadow</td><td>The is the colour of the shadow that is generated behind the widget box. The X and Y axis values can be altered such that the shadow can be set to fall anywhere behind the widget area.<br>"x-offset" - a positive number specifies the shadow will be on the right of the box, and a negative number will put the shadow on the left of the box.<br>"y-offset" - a negative one means the shadow will be above the box, and a positive number means the shadow will be below the box.<br>"Blur" - if the number is set to 0 then the shadow will be sharp. It will more blurred as the number goes higher, and the shadow will extend further away.<br>"Color" - sets the colour of the shadow. If the colour is not set, the box shadows are drawn in the foreground colour.</td></tr><tr><td align="center">Text</td><td>Set the colour of the text. Recommended to set in contrast with the background.</td></tr><tr><td align="center">Loader Color</td><td>Pick the colour to the loading spinner when the component shows the loader before getting displayed.</td></tr><tr><td align="center">Prefix Icon Color</td><td>Choose a specific color for the icon that appears before the actual widget content.</td></tr><tr><td align="center">Suffix Icon Color</td><td>Choose a specific color for the icon that appears after the actual widget content.</td></tr><tr><td align="center">Prefix Icon Size</td><td>Set the size of the prefix icon in px value - 12px</td></tr><tr><td align="center">Suffix Icon Size</td><td>Set the size of the suffix icon in px value - 12px</td></tr><tr><td align="center">Text Transform</td><td>This property specifies how to capitalize an element's text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform">MDN web docs</a></td></tr><tr><td align="center">Text Decoration</td><td>This property sets the appearance of decorative lines on text. Types are "underline", "overline", "line-though", "overline-underline".</td></tr><tr><td align="center">Text Size</td><td>Set the size of the text in px value - 12px</td></tr><tr><td align="center">Text Weight</td><td>Increase or decrease the thickness of the font using the list of numbers from 100-800.</td></tr><tr><td align="center">Font Family</td><td>Type the name of the font family. The reference to the list of font families can be found here: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font-family">MDN web docs</a></td></tr><tr><td align="center">Font Style</td><td>There are 3 types of styles that can be applied:<br>"normal" - The text is shown normally, no style applied.<br>"italic" - The text is cursive.<br>"oblique" - A sloped version of the normal text.</td></tr><tr><td align="center">Border Color</td><td>Set the colour to the border lines. The border lines will be shown only if that is enabled.</td></tr><tr><td align="center">Margin</td><td>This value is set in terms of "px" number which creates the space between the border and the content of the widget.</td></tr><tr><td align="center">Padding</td><td>This value is set in terms of "px" number which creates the space between the border and outer elements.</td></tr><tr><td align="center">Border Radius</td><td>This sets the radius of the widget's corners, enabling rounded corners on the widget. This value is defined in "px" terms.</td></tr><tr><td align="center">Border Width</td><td>Set the thickness of the border of the widget using this value. It is defined using "px" terms.</td></tr></tbody></table>
