Skip to content

Sidepanel

The Sidepanel component is a reusable UI element designed to display contextual or additional information alongside the main content of your application. It slides into view from the edge of the screen, providing a seamless and non-intrusive way to present content such as forms, lists, or detailed views.

Sidepanel Sample

Basic Usage

vue
<template>
  <spr-button tone="success" @click="isSidepanelOpen = true">Open Sidepanel</spr-button>
  <spr-sidepanel :is-open="isSidepanelOpen" @close="isSidepanelOpen = false" header-title="Sidepanel Example">
    <div class="p-4">Sidepanel Content</div>
    <template #footer>
      <div class="px-4 flex justify-end gap-2">
        <spr-button>Cancel</spr-button>
        <spr-button tone="success">Submit</spr-button>
      </div>
    </template>
  </spr-sidepanel>
</template>

Size

vue
<template>
  <div class="flex space-x-4">
    <spr-button tone="success" @click="isSmallSidepanelOpen = true">Small</spr-button>
    <spr-button tone="success" @click="isMediumSidepanelOpen = true">Medium</spr-button>
    <spr-button tone="success" @click="isLargeSidepanelOpen = true">Large</spr-button>
  </div>
  <spr-sidepanel
    size="sm"
    :is-open="isSmallSidepanelOpen"
    @close="isSmallSidepanelOpen = false"
    header-title="Sidepanel Small"
  >
    360px
  </spr-sidepanel>
  <spr-sidepanel
    size="md"
    :is-open="isMediumSidepanelOpen"
    @close="isMediumSidepanelOpen = false"
    header-title="Sidepanel Medium"
  >
    420px
  </spr-sidepanel>
  <spr-sidepanel
    size="lg"
    :is-open="isLargeSidepanelOpen"
    @close="isLargeSidepanelOpen = false"
    header-title="Sidepanel Large"
  >
    480px
  </spr-sidepanel>
</template>

<script lang="ts" setup>
import { ref } from 'vue';

const isSmallSidepanelOpen = ref(false);
const isMediumSidepanelOpen = ref(false);
const isLargeSidepanelOpen = ref(false);
</script>

Slot

NameDescription
headerSlot to customize the header content
footerSlot to customize the footer content

API Reference

NameDescriptionTypeDefault
isOpenControls whether the side panel is open. Set to true to display the side panel or false to hide it.booleanfalse
headerTitleThe title displayed in the side panel's header.string'Sidepanel Header'
sizeSpecifies the size of the side panel.'sm' | 'md' | 'lg''sm'
heightSpecifies the height of the side panel.string | number'calc(100vh - 32px)'
hideHeaderControls the visibility of the side panel header.booleanfalse
hasBackdropDetermines whether a backdrop is displayed behind the side panel.booleantrue
closeOutsideControls whether clicking outside the side panel should close it.booleantrue
@onCloseFunction to call when the sidepanel is closedfunction-

Product Uses

Sprout HR
Sprout Ecosystem
Sprout Sidekick