defaultIconProps
This constant is part of Iconify Utils package.
Constant defaultIconProps contains default values for optional IconifyIcon properties.
It is merged from 2 parts:
defaultIconDimensions
Constant defaultIconDimensions contains default values for icon dimensions:
js
const defaultIconDimensions = {
left: 0,
top: 0,
width: 16,
height: 16,
};
defaultIconTransformations
Constant defaultIconTransformations contains default values for icon transformations:
js
const defaultIconTransformations = {
rotate: 0,
vFlip: false,
hFlip: false,
};
Usage
Function has the following parameter:
- icon, IconifyIcon. Icon data.
Function returns full icon data with type FullIconifyIcon.
Example
usage.ts
ts
import { defaultIconProps } from '@iconify/utils';
const icon = {
...defaultIconProps,
body: '<path d="M7 6v12l10-6z" fill="currentColor"/>',
width: 24,
height: 24,
hFlip: true,
};
console.log(icon);
Result:
json
{
"left": 0,
"top": 0,
"width": 24,
"height": 24,
"rotate": 0,
"vFlip": false,
"hFlip": true,
"body": "<path d=\"M7 6v12l10-6z\" fill=\"currentColor\"/>"
}
It is used in functions that require only partial icon data, such as iconToSVG(), but internally actually use full icon.