DashboardResizeHandle
A handle to resize a sidebar or panel.
Usage
The DashboardResizeHandle component is used by the DashboardSidebar and DashboardPanel components.
It is automatically displayed when the resizable prop is set, you don't have to add it manually.
Examples
Within resize-handle slot
Even though this component is automatically displayed when the resizable prop is set, you can use the resize-handle slot of the DashboardSidebar and DashboardPanel components to customize the handle.
<template>
<PDashboardGroup>
<PDashboardSidebar resizable>
<template #resize-handle="{ onMouseDown, onTouchStart, onDoubleClick }">
<PDashboardResizeHandle
class="hover:after:bg---ui-color-border-accented after:w-px after:transition after:inset-y-0 after:right-0 after:absolute"
@mousedown="onMouseDown"
@touchstart="onTouchStart"
@dblclick="onDoubleClick"
/>
</template>
</PDashboardSidebar>
<slot />
</PDashboardGroup>
</template>
<script setup lang="ts">
definePageMeta({
layout: 'dashboard'
});
</script>
<template>
<PDashboardPanel resizable>
<template #resize-handle="{ onMouseDown, onTouchStart, onDoubleClick }">
<PDashboardResizeHandle
class="hover:after:bg---ui-color-border-accented after:w-px after:transition after:inset-y-0 after:right-0 after:absolute"
@mousedown="onMouseDown"
@touchstart="onTouchStart"
@dblclick="onDoubleClick"
/>
</template>
</PDashboardPanel>
</template>
In this example, we add an
after pseudo-element to display a vertical line on hover.API
Props
| Prop | Default | Type |
|---|---|---|
as | 'div' | anyThe element or component this component should render as. |
ui | { base?: any; } |
Slots
| Slot | Type |
|---|---|
default | {} |
Theme
app.config.ts
export default defineAppConfig({
ui: {
dashboardResizeHandle: {
base: 'hidden cursor-ew-resize select-none relative touch-none lg:block before:content-empty before:inset-y-0 before:absolute before:z-1 before:-left-1.5 before:-right-1.5'
}
}
})vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from 'pohon-ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
dashboardResizeHandle: {
base: 'hidden cursor-ew-resize select-none relative touch-none lg:block before:content-empty before:inset-y-0 before:absolute before:z-1 before:-left-1.5 before:-right-1.5'
}
}
})
]
})Changelog
No recent changes