> ## Documentation Index
> Fetch the complete documentation index at: https://sendforsign.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Template Editor

> TemplateEditor React component: create and edit reusable contract templates inside your app.

The `Template Editor` component is a React component that renders the entire Editor.
This component provides the ability to create new templates and open existing templates.

### Preview

![](https://mintcdn.com/sendforsign/bDeZDTsZ_41-V2Bk/sdk/img/template.png?fit=max\&auto=format\&n=bDeZDTsZ_41-V2Bk\&q=85\&s=618468b73bd31ec4260035f21fc0c800)

Template component

## Usage

First, install [Sendforsign components.](https://sendforsign.com/docs/sdk/introsdk.md#installation)
After that:

```typescript App.tsx theme={null}
import { TemplateEditor } from 'sendforsign';

<TemplateEditor
  token='YourClientToken'
  documentPreview={true}
/>
```

## Props

| Prop | Type | Default | Description |
| - | - | - | - |
| `apiKey` | `string` | | Use only for testing purposes. API key for your platform. |
| `clientKey` | `string` | | Use only for testing purposes. Client key for the account that is using the infrastructure. |
| `token` | `string` | | Client token refers to the client that is using the infrastructure. Learn more about client tokens [here](https://sendforsign.com/docs/api-reference/implementation_server.md#generate-client-tokens). |
| `userKey` | `string` | | User key for the user who is creating a template. |
| `templateKey` | `string` | | Unique template key of the template that needs to be rendered. If not specified, the component will allow you to create a new template from its interface. |
| `сanReDraft` | `boolean` | `false` | If `true`, users can recreate existing templates from scratch. |
| `documentPreview` | `boolean` | `false` | If `true`, opens the template in read-only preview mode and hides the actions bar and sidebar. |
| `onStepChange` | `function(data: {currentStep:string})` | | Called when component changes states and returns `currentStep: 'TypeChooseStep'` when the component is in the Type Choose state, `currentStep: 'ContractEditorStep'` when the component is in the Editor state. |
| `onDocumentSave` | `function(data: {documentSaved:boolean})` | | Called when the contract body is being edited, this function returns `documentSaved: false` if the body is not saved and `documentSaved: true` if the body is saved. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.