---
title: "capture-signature"
description: "Overview"
permalink: /docs/build/ui-components/all-ui-components/capture-signature/
---
# capture-signature

## Overview

<Info title={"Version compatibility"}>

The `capture-signature` component was visually updated in version **4.74.0** of the JourneyApps Runtime.

</Info>

Allows users to capture a signature digitally.

### Using signatures

Signatures are captured as SVG's with a path that describes it. That path can be accessed using toText():

```javascript
// Get the SVG text of the signature as XML
// Assuming the name of the signature is `captured_sig`
var signatureSVG = view.captured_sig.toText();
```

Signatures can also be printed using a Zebra bluetooth printer ([see docs](/docs/build/integration/journeyapps-print-android/)) directly from version 4.34.4 of the JourneyApps Container. The Zebra printer uses a language called ZPL, so we can convert the signature to ZPL by using:

```javascript
// Get the SVG text of the signature as ZPL
// Assuming the name of the signature is `captured_sig`
var signatureSVG = view.captured_sig.toZPL();
```

### Basic Example

```xml
<var name="my_signature" type="signature" />

<capture-signature label="Add a signature" bind="my_signature" required="true" />
```

![](./media/spaces-2f9tchlr67elhbojpvhhud-2fuploads-2fxcq52rqq9tlyavvqlft1-2fcapture-signature-example-723f0eb4.png)

![](./media/spaces-2f9tchlr67elhbojpvhhud-2fuploads-2f6r4nddxahfc12dj8qpts-2fcapture-signature-example-open-0726390e.png)

## Advanced Attributes

### `dialog-title`

<SyntaxCard type={"string (static text, format string, or JS/TS function result)"} defaultValue={"\"Sign here\""} introduced="4.88.0" />

Override the title that is displayed at the top of the dialog when capturing a signature.

**main.view\.xml**

```xml
<capture-signature label="Add a signature" bind="my_signature" dialog-title="Custodian signature" required="true" />   
```

![](./media/spaces-2f9tchlr67elhbojpvhhud-2fuploads-2fmoidm0cqdzmrwzeg6yo1-2fcapture-signature-dialog-title-3cb01b93.png)

### `fullwidth`

<SyntaxCard type={"boolean"} defaultValue={"false"} />

Specify whether the signature preview should span the full width of the available screen space.

### capture-signature

```xml
<capture-signature bind="authorization_sig" label="Authorized" fullwith="true"/>
```

### display-signature

```xml
<capture-signature bind="authorization_sig" label="Authorized" fullwith="true"/>
```

![](./media/spaces-2f9tchlr67elhbojpvhhud-2fuploads-2fgit-blob-276fd3ac63e476b3ebc3ab271f6a5ca3aa77e2e1-2fcapture-signature-fullwidth-5f157026.png)

### `orientation`

<Info title={"Version compatibility"}>

* `orientation` was introduced in version **4.88.0** of the JourneyApps Runtime and is supported on mobile platforms: Android and iOS.
* Container version **23.5.1** or later is required for this feature on iOS, and is recommended for Android.

</Info>

<SyntaxCard type={["auto","landscape","portrait"]} defaultValue={"auto"} />

Lock the orientation of the draw-pad for capturing a signature.

When `orientation` is set to `landscape` or `portrait`, the draw-pad will always display in the specified orientation, regardless of the orientation of the device. When `orientation` is set to `auto`, or not specified, the orientation of the draw-pad mirrors the orientation of the device.

### `align-content`

<AttributeReference label="align-content" href="/docs/build/ui-components/common-attributes/align-content/" badge="advanced" tone="muted" />

### `align-controls`

<AttributeReference label="align-controls" href="/docs/build/ui-components/common-attributes/align-controls/" badge="advanced" tone="muted" />

### `align-label`

<AttributeReference label="align-label" href="/docs/build/ui-components/common-attributes/align-label/" badge="advanced" tone="muted" />

### `control-order`

<AttributeReference label="control-order" href="/docs/build/ui-components/common-attributes/control-order/" badge="advanced" tone="muted" />

### `disabled`

<AttributeReference label="disabled" href="/docs/build/ui-components/common-attributes/disabled/" badge="advanced" tone="muted" />

### `icon-position`

<AttributeReference label="icon-position" href="/docs/build/ui-components/common-attributes/icon-position/" badge="advanced" tone="muted" />

### `id`

<AttributeReference label="id" href="/docs/build/ui-components/common-attributes/id/" badge="advanced" tone="muted" />

### `label-case`

<AttributeReference label="label-case" href="/docs/build/ui-components/common-attributes/label-case/" badge="advanced" tone="muted" />

### `label-color`

<AttributeReference label="label-color" href="/docs/build/ui-components/common-attributes/label-color/" badge="advanced" tone="muted" />

### `on-change`

<AttributeReference label="on-change" href="/docs/build/ui-components/common-attributes/on-change/" badge="advanced" tone="muted" />

### `show-if`

<AttributeReference label="show-if" href="/docs/build/ui-components/common-attributes/show-if/" badge="advanced" tone="muted" />

### `hide-if`

<AttributeReference label="hide-if" href="/docs/build/ui-components/common-attributes/hide-if/" badge="advanced" tone="muted" />

## Common Attributes

### `bind`

<AttributeReference label="bind" href="/docs/build/ui-components/common-attributes/bind/" />

### `label`

<AttributeReference label="label" href="/docs/build/ui-components/common-attributes/label/" />

### `required`

<AttributeReference label="required" href="/docs/build/ui-components/common-attributes/required/" />

## Component Methods

The following component methods are available when an [`id`](/docs/build/ui-components/common-attributes/id/) is assigned to the component and `component.captureSignature({id:'my-id'})` / `component.displaySignature({id:'my-id'})` is called from JS/TS:

### `captureMedia`

Programmatically open the signature dialog that allows the user to sign.

```javascript
try {
    component.captureSignature({id: 'my-id'}).captureMedia();
} catch (e) {
    // handle exception here
}
```

### `closeMedia`

Programmatically close the signature preview.

### capture-signature

```javascript
try {
    component.captureSignature({id: 'my-id'}).closeMedia();
} catch (e) {
    // handle exception here
}
```

### display-signature

```javascript
try {
    component.displaySignature({id: 'my-id'}).closeMedia();
} catch (e) {
    // handle exception here
}
```

### `deleteMedia`

Programmatically clear a captured signature.

```javascript
try {
    component.captureSignature({id: 'my-id'}).deleteMedia();
} catch (e) {
    // handle exception here
}
```

<Warning>

`deleteMedia` will trigger an [`on-change`](#on-change) if a function is assigned to it.

</Warning>

### `openMedia`

Programmatically open the signature preview.

### capture-signature

```javascript
try {
    component.captureSignature({id: 'my-id'}).openMedia();
} catch (e) {
    // handle exception here
}
```

### display-signature

```javascript
try {
    component.displaySignature({id: 'my-id'}).openMedia();
} catch (e) {
    // handle exception here
}
```

### `scrollIntoView`

Programmatically scroll until the `capture-signature` / `display-signature` component is visible in the view.

### capture-signature

```javascript
try {
    component.captureSignature({id: 'my-id'}).scrollIntoView();
} catch (e) {
    // handle exception here
}
```

### display-signature

```javascript
try {
    component.displaySignature({id: 'my-id'}).scrollIntoView();
} catch (e) {
    // handle exception here
}
```
