Skip to content

Sidebar

A sidebar to use as left/right overlay or static

Examples

Base

Show code

Inline

Show code

Component Prop

Show code

Programmatically

Show code

Class props

'Classes applied to the element'

A sidebar to use as left/right overlay or static

html
<o-sidebar></o-sidebar>

Props

Prop nameDescriptionTypeValuesDefault
activeWhether siedbar is active or not, use v-model:active to make it two-way bindingboolean-false
animationCustom animation (transition name)string-
From config:
sidebar: {
  animation: undefined
}
cancelableIs Sidebar cancleable by pressing escape or clicking outside.boolean | string[]escape, outside, true, false
From config:
sidebar: {
  cancelable: ["escape","outside"]
}
componentComponent to be injected, used to open a component sidebar programmatically.
Close sidebar within the component by emitting a 'close' event — emits('close')
Component-
eventsEvents to be binded to the injected component{}-
expandOnHoverExpand sidebar on hover when reduced or mobile is reduceboolean-
From config:
sidebar: {
  expandOnHover: false
}
fullheightShow sidebar in fullheightboolean-
From config:
sidebar: {
  fullheight: false
}
fullwidthShow sidebar in fullwidthboolean-
From config:
sidebar: {
  fullwidth: false
}
inlineDisplay the Sidebear inlineboolean-false
mobileCustom layout on mobile"expanded" | "reduced" | "hidden"expanded, reduced, hidden
From config:
sidebar: {
  mobile: undefined
}
mobileBreakpointMobile breakpoint as max-width valuestring-
From config:
sidebar: {
  mobileBreakpoint: undefined
}
overlayShow an overlay like modalboolean-
From config:
sidebar: {
  overlay: false
}
overrideOverride existing theme classes completelyboolean-
positionSidebar position"left" | "right" | "top" | "bottom"top, right, bottom, left
From config:
sidebar: {
  position: "left"
}
propsProps to be binded to the injected componentany-
reduceShow a small sidebarboolean-
From config:
sidebar: {
  reduce: false
}
scrollUse clip to remove the body scrollbar, keep to have a non scrollable scrollbar to avoid shifting background,
but will set body to position fixed, might break some layouts.
"keep" | "clip"keep, clip
From config:
sidebar: {
  scroll: "clip"
}
teleportAppend the component to another part of the DOM.
Set true to append the component to the body.
In addition, any CSS selector string or an actual DOM node can be used.
string | boolean | object-
From config:
sidebar: {
  teleport: false
}

Events

Event namePropertiesDescription
update:activevalue boolean - updated active propactive prop two-way binding
closevalue unknown - close event dataon component close event

Slots

NameDescriptionBindings
defaultSidebar default content, default is component propclose (...args):void - function to close the component

Sass variables

Current theme ➜ Oruga

SASS VariableDefault
$sidebar-overlayhsla(0, 0%, 4%, 0.86)
$sidebar-box-shadow5px 0px 13px 3px rgba(var(--#{$prefix}black), 0.1)
$sidebar-content-background-colorvar(--#{$prefix}grey-lighter)
$sidebar-border-radiusvar(--#{$prefix}base-border-radius)
$sidebar-border-width1px
$sidebar-border-colorrgba(0, 0, 0, 0.175)
$sidebar-reduced-width80px
$sidebar-width260px
$sidebar-zindex100

See ➜ 📄 Full scss file

Current theme ➜ Bulma

SASS VariableDefault
$sidebar-colorsvar.$colors
$sidebar-z40
$sidebar-background-background-colorhsla( #{css.getVar("scheme-h")}, #{css.getVar("scheme-s")}, #{css.getVar("scheme-invert-l")}, 0.86)
$sidebar-shadowcss.getVar("shadow")
$sidebar-width260px
$sidebar-height260px
$sidebar-mobile-width80px

See ➜ 📄 Full scss file

Current theme ➜ Bootstrap

SASS VariableDefault
$sidebar-reduced-width5rem
$sidebar-reduced-height10vh

See ➜ 📄 Full scss file

Released under the MIT License.