# ComponentSchema

Class · category: Other

Source: https://github.com/playcanvas/editor-api/blob/4303c34bcee9a418297350899ad3a3f555526ec4/src/schema/components.ts#L7

Provides methods to access the components schema

## Constructors

### constructor

```ts
new ComponentSchema(schema: Schema)
```

Creates new instance of API

**Parameters**

- `schema` ([`Schema`](https://api.playcanvas.com/editor/classes/Schema.md)): The schema API

## Methods

### getDefaultData

```ts
getDefaultData(component: string): Record<string, any>
```

Gets default data for a component

**Parameters**

- `component` (`string`): The component name

**Returns** `Record<string, any>`: The default data

**Example**

```javascript
const modelData = editor.schema.components.getDefaultData('model');
```

### getFieldsOfType

```ts
getFieldsOfType(componentName: string, type: string): string[]
```

Gets a list of fields of a particular type for a component

**Parameters**

- `componentName` (`string`): The component name
- `type` (`string`): The desired type

**Returns** `string[]`: A list of fields

**Example**

```javascript
const buttonEntityFields = editor.schema.components.getFieldsOfType('button', 'entity');
```

### list

```ts
list(): string[]
```

Gets a list of all the available components

**Returns** `string[]`: The components
