Layout & structure
Layout
Resizable
A drag handle that resizes a panel between a minimum and a maximum size. Use it for sidebars and split views.
This site’s sidebar is built with Resizable. Drag its right edge to try it.
Install
import { Resizable } from 'vael-ui'Playground
Drag the handle
horizontal
end
Placement, behaviour and animation
Usage
<script setup lang="ts">
import { Resizable } from 'vael-ui'
</script>
<template>
<Resizable :min="120" :max="280" :size="200">Drag the handle</Resizable>
</template>Motion New
Resizable: its appearance and states.
<Resizable
:motion="{ states: { dragging: { root: { scale: 1.04 } } } }"
/>| Name | Type | Description |
|---|---|---|
initialexit | roothandle | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
states | dragging | Sets values per part that hold while a state is on. An array is a set of keyframes that plays once as the state turns on, such as a shake on invalid. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
Follows the Window Splitter pattern from the WAI-ARIA Authoring Practices Guide.
| Key | Action |
|---|---|
| ArrowLeftArrowRight | Moves the handle 16 px and resizes the panel, when direction is horizontal. |
| ArrowUpArrowDown | Moves the handle 16 px and resizes the panel, when direction is vertical. |
| Home | Sets the panel to its min size. |
| End | Sets the panel to its max size, when max is set. |
- The handle has
role="separator"and is a Tab stop. Withdisabled, it leaves the tab order. - It sets
aria-valuenowto the size in pixels andaria-valuemintomin.aria-valuemaxismax, or the room its container gives it when there’s nomax. - The handle is named “Resize” by default (the
resizable.labelmessage). Passaria-labelto say which panel it resizes. - With
edge="both"there are two handles, named “Resize start” and “Resize end” (theresizable.startandresizable.endmessages). Withv-model:offsetthe panel itself is a Tab stop: the arrow keys move the whole span a step. - Right to left, ArrowLeft and ArrowRight swap.