Sidebar โ
A sidebar to use as left/right overlay or static
Examples โ
Base
Example
<section>
<o-field grouped>
<o-switch v-model="overlay">Overlay</o-switch>
<o-switch v-model="fullheight">Fullheight</o-switch>
<o-switch v-model="fullwidth">Fullwidth</o-switch>
<o-switch v-model="right">Right</o-switch>
</o-field>
<o-button @click="open = true">Show</o-button>
<o-sidebar
v-model:open="open"
:fullheight="fullheight"
:fullwidth="fullwidth"
:overlay="overlay"
:right="right">
<o-button
v-if="fullwidth"
icon-left="times"
label="Close"
@click="open = false" />
<img
width="128"
src="https://avatars2.githubusercontent.com/u/66300512?s=200&v=4"
alt="Lightweight UI components for Vue.js" />
<h3>Example</h3>
</o-sidebar>
</section>
import { ref } from "vue";
const open = ref(false);
const overlay = ref(true);
const fullheight = ref(true);
const fullwidth = ref(false);
const right = ref(false);
css
Static
Example 1
Example 2
Example 3
Example 4
Example 5
<section class="sidebar-page">
<div class="sidebar-layout">
<o-sidebar
position="static"
:mobile="mobile"
:expand-on-hover="expandOnHover"
:reduce="reduce"
open>
<img
width="128"
src="https://avatars2.githubusercontent.com/u/66300512?s=200&v=4"
alt="Lightweight UI components for Vue.js" />
<section style="padding: 1em">
<h5>Example 1</h5>
<h5>Example 2</h5>
<h5>Example 3</h5>
<h5>Example 4</h5>
<h5>Example 5</h5>
</section>
</o-sidebar>
</div>
<div class="sidebar-layout">
<o-field>
<o-switch v-model="reduce">Reduced</o-switch>
</o-field>
<o-field>
<o-switch v-model="expandOnHover">Expand on hover</o-switch>
</o-field>
<br />
<o-field label="Mobile Layout">
<o-select v-model="mobile">
<option :value="null"></option>
<option value="reduced">Reduced</option>
<option value="hidden">Hidden</option>
<option value="fullwidth">Fullwidth</option>
</o-select>
</o-field>
</div>
</section>
import { ref } from "vue";
const expandOnHover = ref(false);
const mobile = ref("reduced");
const reduce = ref(false);
.sidebar-page {
display: flex;
flex-direction: row;
width: 100%;
.sidebar-layout {
padding: 1rem;
flex-basis: 50%;
}
}
Class props โ
Example 1
Example 2
Example 3
Example 4
Example 5
Class props inspector is useful to see class props you want to use to customize Oruga components and how they change a component. You can click on Inspect button to find the exact element where a specific class prop acts.
In the Class props inspector there are other columns
Class prop
This column contains the name of the Class prop you want to inspect.
If you find a name with a link ( โท classPropName) this refers to a subitem (e.g. Dropdown Item in Dropdown).
Description
This column contains the description of the Class prop you want to inspect.
๐ This icon indicates some warning, e.g. this Class prop is visible only on mobile.
๐ This icon indicates that you should pay attention to CSS specificity. See "Deal with specificity" section in the documentation.
Props
This column contains a list of props that activate the class, e.g. if a class prop contains disabled
prop it means that only when the component has disabled
prop.
Suffixes
This column contains all the possible suffixes that you'll receive if you use a function to customize your Class prop. You'll find more info in the "Overriding section" .
Class prop | Description | Props | Suffixes | |
---|---|---|---|---|
absoluteClass | Class of the sidebar when its position is absolute. ๐ Scroll to the top of this page to see the sidebar | position | ||
contentClass | Class of the sidebar content. | |||
expandOnHoverClass | Class of the sidebar when expanded on hover. | expandOnHover | ||
expandOnHoverFixedClass | Class of the sidebar when expanded on hover and its position is fixed. | expandOnHover | ||
fixedClass | Class of the sidebar when its position is fixed. | position | ||
fullheightClass | Class of the sidebar when is fullheight. | fullheight | ||
fullwidthClass | Class of the sidebar when is fullwidth. | fullwidth | ||
hiddenClass | Class of the sidebar when sidebar is hidden. | |||
mobileClass | Class of sidebar component when on mobile. ๐ Switch to mobile view to see it in action! | |||
overlayClass | Class of the sidebar overlay. | |||
reduceClass | Class of the sidebar when reduced. | reduce | ||
rightClass | Class of the sidebar when is positioned on the right. | right | ||
rootClass | Class of the root element. | |||
staticClass | Class of the sidebar when its position is static. | position | ||
variantClass | Class of the sidebar variant. | variant | primary | |
visibleClass | Class of the sidebar when sidebar is visible. |
Sidebar component โ
<o-sidebar></o-sidebar>
Props โ
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
canCancel | Sidebar cancel options | array|boolean | true , false , 'escape' , 'outside' | From config: sidebar: { |
expandOnHover | Expand sidebar on hover when reduced or mobile is reduce | boolean | - | |
expandOnHoverFixed | Expand sidebar on hover with fixed position when reduced or mobile is reduce | boolean | - | |
fullheight | Show sidebar in fullheight | boolean | - | |
fullwidth | Show sidebar in fullwidth | boolean | - | |
mobile | Custom layout on mobile | string | fullwidth , reduced , hidden | |
mobileBreakpoint | Mobile breakpoint as max-width value | string | - | |
onCancel | Callback on cancel | func | - | Default function (see source code) |
open | To control the behaviour of the sidebar programmatically, use the v-model:open to make it two-way binding | boolean | - | |
overlay | Show an overlay like modal | boolean | - | |
override | boolean | - | ||
position | Skeleton position in relation to the window | string | fixed , absolute , static | From config: sidebar: { |
reduce | Show a small sidebar | boolean | - | |
right | Show the sidebar on right | boolean | - | |
scroll | string | - | From config: sidebar: { | |
variant | Color of the sidebar, optional | string|object | primary , info , success , warning , danger , and any other custom color |
Events โ
Event name | Properties | Description |
---|---|---|
update:open | ||
close |
Slots โ
Name | Description | Bindings |
---|---|---|
default |
Sass variables โ
Current theme โ Oruga Base
SASS Variable | Default |
---|---|
$sidebar-overlay | hsla(0, 0%, 4%, 0.86) |
$sidebar-box-shadow | 5px 0px 13px 3px rgba($black, 0.1) |
$sidebar-content-background-color | $grey-lighter |
$sidebar-mobile-width | 80px |
$sidebar-width | 260px |
$sidebar-zindex | 38 |
See โ ๐ Full scss file
Current theme โ Oruga Full
SASS Variable | Default |
---|---|
$sidebar-overlay | hsla(0, 0%, 4%, 0.86) |
$sidebar-box-shadow | 5px 0px 13px 3px rgba($black, 0.1) |
$sidebar-content-background-color | $grey-lighter |
$sidebar-mobile-width | 80px |
$sidebar-width | 260px |
$sidebar-zindex | 38 |
See โ ๐ Full scss file
Current theme โ Bulma
The theme does not have any custom variables for this component.
Current theme โ Bootstrap
SASS Variable | Default |
---|---|
$sidebar-reduced-width | 5rem |
$sidebar-reduced-height | 10vh |
See โ ๐ Full scss file