# Inside Buttons

You can also add buttons to fields.

![Buttons screenshot](https://298286010-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LQ-0ugDv-u9c49g8Mn0%2F-LThHlIS4PKNoab1CbeQ%2F-LThHnBhL9GtTv6lWF-i%2Fvfg-buttons.png?generation=1544800648791673\&alt=media)

## Properties

| Property | Default  | Accepted values          | Description                                                    |
| -------- | -------- | ------------------------ | -------------------------------------------------------------- |
| classes  | _none_   | `String`                 | CSS classes for the button                                     |
| label    | _none_   | `String`                 | Caption of the button                                          |
| onclick  | _none_   | `Function(model, field)` | Triggered when click on the button                             |
| type     | "button" | `String`                 | The HTML "type" attribute for the button, defaults to "button" |

## Example

The below example uses two buttons to read the location of the user and clear the location value.

```javascript
{
  type: "input",
  inputType: "text",
  label: "Location",
  model: "address.geo",
  buttons: [
      {
          classes: "btn-location",
          label: "Current location",
          onclick: function(model) {
              if (navigator.geolocation) {
                  navigator.geolocation.getCurrentPosition(function(pos) {
                    model.address.geo = {
                      lat: pos.coords.latitude.toFixed(5),
                      lng: pos.coords.longitude.toFixed(5)
                    };
                  });
              } else {
                  alert("Geolocation is not supported by this browser.");
              }
          }
      },
      {
          classes: "btn-clear",
          label: "Clear",
          type: "reset"
          onclick: function(model, field) {
              model.address.geo = {
                  lat: 0,
                  lng: 0
              };
          }
      }
  ]
}
```
