# Symbol Override
```javascript
var overrides = symbolInstance.overrides
```
A [Symbol](https://sketch.com/docs/symbols/) override. This component is not exposed, it is only returned when accessing the `overrides` of a [Symbol Instance](#symbol-instance) or [Symbol Source](#symbol-source). The overrides are not available until after the instance is injected into the document.
| Properties | |
| --- | --- |
| pathstring | The path to the override. It's formed by the symbolId of the nested symbols separated by a `/`. |
| propertystring | The property that this override controls. See below for what properties are available. |
| idstring | The unique ID of the override (`${path}_${property}`). |
| symbolOverrideboolean | If the override is a nested Symbol override. |
| colorOverrideboolean | If the override is a color override. |
| textOverrideboolean | If the override is a text override. |
| imageOverrideboolean | If the override is an image override. |
| valuestring / [ImageData](#imagedata) | The value of the override which can be changed. |
| isDefaultboolean | If the override hasn't been changed and is the default value. |
| defaultValuestring / [ImageData](#imagedata) | The default value for the override. |
| affectedLayer[Layer](#layer) / [Text](#text) / [Image](#image) / [Symbol Instance](#symbolinstance) | The layer the override applies to. It will be an immutable version of the layer. |
| editableboolean | If the value of the override can be changed. |
| selectedboolean / undefined | If the override is selected (or `undefined` if it's the override of a Symbol Source). |
| Methods | |
| --------- | ---------------------------------------- |
| `reset()` | Reset the override to its default value. |
## Text Overrides
```js
if (override.property === 'stringValue') {
override.value = 'an overridden text'
}
if (override.property === 'textStyle') {
override.value = someTextStyle.id
}
if (override.property === 'textSize') {
override.value = String(32)
}
if (override.property === 'textColor') {
override.value = '#FF00FF'
}
if (override.property === 'textDecoration') {
// 'none', 'underline', or 'strikethrough'
override.value = 'underline'
}
if (override.property === 'textHAlign') {
const { Text } = require('sketch/dom')
override.value = Text.Alignment.right
}
```
| `Override.property` | `Override.value` |
| --- | --- |
| `stringValue` | Text contents string |
| `textStyle` | Text style identifier string |
| `textSize` | Font size string |
| `textColor` | Text color string |
| `textDecoration` | Text decoration string |
| `textHAlign` | Text horizontal alignment string / number |
## Symbol Overrides
```js
if (override.symbolOverride) { ... }
if (override.property === 'symbolID') {
override.value = someOtherSymbol.id
}
```
| `Override.property` | `Override.value` |
| --- | --- |
| `symbolID` | A symbol identifier for a nested instance string |
## Image Overrides
```js
if (override.property === 'image') {
// Value could be one of:
// - an `ImageData`
// - a `Buffer`
// - a native `NSImage`
// - a native `NSURL`
// - a native `MSImageData`
// - a string: path to an image file
// - an object with a `path` property: path to an image file
// - an object with a `base64` string: a base64 encoded image
override.value = ImageData.from(...)
override.value = {
base64: "..."
}
// etc
}
if (override.property === 'imageResizeBehavior') {
const ResizeBehavior = Object.freeze({
Stretch: 0,
Original: 1,
Fit: 2,
Fill: 3
})
const currentValue = Object.keys(ResizeBehavior).find((k) => {
return String(ResizeBehavior[k]) === override.value
})
if (currentValue === 'Original') {
override.value = ResizeBehavior.Stretch
}
}
```
| `Override.property` | `Override.value` |
| --- | --- |
| `image` | A nested image [ImageData](#imagedata) |
| `imageResizeBehavior` | A nested image sizing string / number |
## Color Overrides
```js
if (override.colorOverride) { ... }
if (override.property === 'color:fill-0') {
override.value = '#aa7080'
console.log(
`First fill color for "${override.affectedLayer.name}": ${override.value}`,
)
// 👉 First fill color for "Rectangle": #aa7080
}
```
| `Override.property` | `Override.value` |
| --- | --- |
| `textColor` | Text color string |
| `fillColor` | Group tint color string |
| `color:fill-N` | N-th fill color string |
| `color:border-N` | N-th border color string |
| `color:shadow-N` | N-th shadow color string |
| `color:innershadow-N` | N-th inner shadow color string |
| `swatchValue` | Color Variable value [Swatch](#swatch) / undefined |
| `defaultSwatchValue` | A default Color Variable value [Swatch](#swatch) / undefined |
| `blendMode:fill-N` | The blend mode for the N-th fill color |
| `opacity:fill-N` | The opacity value for the N-th fill color |
## Layer Overrides
```js
if (override.property === 'layerStyle') {
override.value = someLayerStyle.id
}
if (override.property === 'flowDestination') {
override.value = someHotspotLayer.id
}
if (override.property === 'isVisible') {
override.value = false
}
if (override.property === 'horizontalSizing') {
const { FlexSizing } = require('sketch/dom')
const currentValue = Object.keys(FlexSizing).find((k) => {
return String(FlexSizing[k]) === override.value
})
if (currentValue === 'Fixed') {
override.value = FlexSizing.Fill
}
}
```
| `Override.property` | `Override.value` |
| --- | --- |
| `layerStyle` | A shared layer style identifier string |
| `flowDestination` | A hotspot target identifier string |
| `isVisible` | A layer visibility flag boolean |
| `horizontalSizing` | Layer sizing options [FlexSizing](#flexsizing) |
| `verticalSizing` | Layer sizing options [FlexSizing](#flexsizing) |
## Get the frame of an Override
```javascript
var frame = override.getFrame()
```
The frame of an override can be different than the frame of its affected Layer in case where the Symbol Instance has been scaled for example.
### Returns
A [Rectangle](#rectangle) describing the frame of the affected layer in the Symbol Instance's coordinates.