# ViewElementObjectDefinition

interface

A plain object that describes a view element in a way that a concrete, exact view element could be created from that description.

```typescript
const viewDefinition = {
	name: 'h1',
	classes: [ 'foo', 'bar' ]
};
```

Above describes a view element:

```html
<h1 class="foo bar"></h1>
```

An example with styles and attributes:

```typescript
const viewDefinition = {
	name: 'span',
	styles: {
		'font-size': '12px',
		'font-weight': 'bold'
	},
	attributes: {
		'data-id': '123'
	}
};
```

Describes:

```typescript
<span style="font-size:12px;font-weight:bold" data-id="123"></span>
```

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/elementdefinition.ts#L49)

<a id="properties">

## Properties

<a id="member-attributes">

### `attributes?: Record<string, string>`

Object with key-value pairs representing attributes. Each object key represents attribute name. Value under that key must be a string.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/elementdefinition.ts#L70)

<a id="member-classes">

### `classes?: ArrayOrItem<string>`

Class name or array of class names to match. Each name can be provided in a form of string.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/elementdefinition.ts#L59)

<a id="member-name">

### `name: string`

View element name.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/elementdefinition.ts#L54)

<a id="member-priority">

### `priority?: number`

Element's [priority](module_engine_view_attributeelement-ViewAttributeElement.md#member-priority).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/elementdefinition.ts#L75)

<a id="member-styles">

### `styles?: Record<string, string>`

Object with key-value pairs representing styles. Each object key represents style name. Value under that key must be a string.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/view/elementdefinition.ts#L64)

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
