useSetItemSize
Returns setter functions to change the size of the widget on the dashboard.
function useSetItemSize(): {setWidth: SetterOrUpdater<number>; setHeight: SetterOrUpdater<number>}
Returns
An object with the setter functions setWidth and setHeight. Like the setter of useState, they take either the new
size in pixels or a function receiving the previous size.
Example
src/widgets/example/Example.tsx
import React from 'react'
import {useSetItemSize} from '@modbros/dashboard-sdk'
export default function Example() {
const {setWidth, setHeight} = useSetItemSize()
return (
<button
onClick={() => {
setWidth((width) => width * 2)
setHeight(200)
}}
>
Resize
</button>
)
}