@itwin/itwinui-react
Version:
A react component library for iTwinUI
38 lines (37 loc) • 1.18 kB
TypeScript
import * as React from 'react';
export type ResizerProps = {
/**
* Ref of the element that is being resized.
*/
elementRef: React.RefObject<HTMLElement | null>;
/**
* Ref of the container element in order to avoid resizing past container boundaries.
* If not passed, viewport will be used.
*/
containerRef?: React.RefObject<HTMLElement | null>;
/**
* Callback that is being called on resize start.
* Useful to set state, style, or other properties when resizing is started.
*/
onResizeStart?: () => void;
/**
* Callback that is being called on resize end.
* Useful to preserve state if element is being closed.
*/
onResizeEnd?: (style: React.CSSProperties) => void;
};
/**
* Component that allows to resize parent element.
* Parent must have `position: relative`.
*
* Ideally should be used within a shadow root.
* @private
* @example
* const ref = React.useRef<HTMLDivElement>(null);
* return (
* <div ref={ref} style={{ position: 'relative' }}>
* <Resizer elementRef={ref} />
* </div>
* );
*/
export declare const Resizer: (props: ResizerProps) => React.JSX.Element;