Set the initial height and width using normal styles.
<k-resize
style="height: 200px; width: 200px;"
>
Resize Me
</k-resize>
Resize Me
Set the minimum and maximum height and width using normal styles. The default min-height and min-width is 10rem and the default max-height and max-width is 100%.
<k-resize
style="min-height: 100px; height: 200px; max-height: 300px; min-width: 100px; width: 200px; max-width: 300px;"
>
Resize Me
</k-resize>
Resize Me
<k-resize
style="height: 200px; width: 200px;"
dimension="width"
>
Resize Width
</k-resize>
Resize Width
<k-resize
style="height: 200px; width: 200px;"
dimension="height"
>
Resize Height
</k-resize>
Resize Height
Additional styles may be added to the example output (borders, spacing, colors) for demonstration.
new Resize()
resizing: stringIndicates which handle is currently being used to resize the element. Values can be "side", "bottom", "corner", or empty string. Syncs with the resizing attribute.
dimension: stringRestricts resizing to a specific dimension. Possible values are "width" (horizontal only) or "height" (vertical only). If not specified, both dimensions can be resized. Syncs with the dimension attribute.
disabled: BooleanWhen true, the resize handles can't capture pointer events — a drag can't start, and any in-progress drag handlers no-op. Handles fade to opacity: 0.4 as a visual cue. Syncs with the disabled attribute.
defaultThe main content area that will be resizable. Content automatically gets scroll behavior when it overflows the container.
The resize component provides three types of handles:
The component respects the following CSS custom properties:
--handle_size: Size of the resize handles (default: 1rem)--c_border: Border color of the container--c_highlight: Background color of active handles during resize--radius: Border radius of the containerThe component supports both mouse and touch interactions for resizing on desktop and mobile devices.