Custom scrollbars

npm install @tis-cca/browser-styles

Usage

Custom scrollbars allow to style the default browser scrollbars.
  • Style a scrollbar with mixins:
    1. Make sure you import the npm install @tis-cca/browser-styles NPM package.
    2. Include the mixin @include tca-scrollbar in your code, on an element that has an overflow scroll behavior.
  • Style a scrollbar by using css classes:
    1. Make sure you import the npm install @tis-cca/browser-styles NPM package.
    2. Add the class tca-scrollbar on a DOM element. Any element that has an overflow scroll behavior is possible.

Variants

  • Scrollbars can be shown either with- or without buttons.
    • The default does not show buttons!
    • If you want buttons to be shown, you need to add one of these modifiers:
      • @include tca-scrollbar--buttons-visible
      • css class: tca-scrollbar--buttons-visible
  • The background of the scrollbar (track) is hidden by default but can be shown.
    • The default does not show a background (track)!
    • If you want the track to be shown, you need to add one of these modifiers:
      • @include tca-scrollbar--track-visible
      • css class: tca-scrollbar--track-visible

Title

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.

<div class="tca-button-group">
   <button class="tca-button" onclick="ToggleScrollbar()">Toggle scrollbar</button>
   <button class="tca-button" onclick="ToggleScrollbarTrack()">Toggle scrollbar track</button>
   <button class="tca-button" onclick="ToggleScrollbarButtons()">Toggle scrollbar buttons</button>
</div>

<div style="max-height: 250px; padding: 1rem; overflow-y: auto;" id="tca-scrollbar-demo">
  <h2>Title</h2>
  <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.</p>
  <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.</p>
  <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.</p>
  <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Perspiciatis non, inventore incidunt repudiandae id vel nisi officiis provident iste necessitatibus. Ex recusandae eveniet tempora.</p>
</div>

<script>
function ToggleScrollbar() {
var x = document.getElementById('tca-scrollbar-demo');
x.classList.toggle("tca-scrollbar");}

function ToggleScrollbarButtons() {
var x = document.getElementById('tca-scrollbar-demo');
x.classList.toggle("tca-scrollbar--buttons-visible");}

function ToggleScrollbarTrack() {
var x = document.getElementById('tca-scrollbar-demo');
x.classList.toggle("tca-scrollbar--track-visible");}
</script>

Layout grid

General layout for styleguide components is done with the help of the layout-grid

  • tis-cca styleguide uses the @material/layout-grid as a basis with some smaller modifications. Detailed documentation on how to use mdc-layout-grid can be found on their github page.
  • Our implementation of is distributed in the npm install @tis-cca/grid-layout package.

Standard Grid (12 col)

The layout-grid has 12 columns on desktop, 8 columns on tablet and 4 columns on phone.

Grid of 1 column wide items
1
1
1
1
1
1
1
1
1
1
1
1
<div class="demo-grid-legend">Grid of 1 column wide items</div>
<div class="demo-grid mdc-layout-grid">
   <div class="mdc-layout-grid__inner">
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
       <div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-1">1</div>
   </div>
</div>

Arranging form elements in a two column grid

  • a mdc-layout-grid__cell--span-6-desktop modifier defines, that the cell should consume 6 out of the 12 available columns. This results in the inputs taking up 50% of the available space of the container.
  • to mimic this behavior on a tablet viewport, a mdc-layout-grid__cell--span-4-tablet modifier should be set. This defines that the cell should consume 4 out of the 8 available columns so that the inputs still consume 50% of the available space.
<div class="mdc-layout-grid inventory-grid">
   <div class="mdc-layout-grid__inner inventory-grid__inner">
     <div class="inventory-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-6-desktop mdc-layout-grid__cell--span-4-tablet">
         <div class="inventory-cell__element">
             <label class="inventory-cell__label">Input #1 in column #1</label>
             <input class="inventory-cell__input">
         </div>
         <div class="inventory-cell__element">
             <label class="inventory-cell__label">Input #2 in column #1</label>
             <input class="inventory-cell__input">
         </div>
     </div>
     <div class="inventory-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-6-desktop mdc-layout-grid__cell--span-4-tablet">
         <div class="inventory-cell__element">
             <label class="inventory-cell__label">Input #1 in column #2</label>
             <input class="inventory-cell__input">
         </div>
         <div class="inventory-cell__element">
             <label class="inventory-cell__label">Input #2 in column #2</label>
             <input class="inventory-cell__input">
         </div>
     </div>
   </div>
</div>

Grid mit verschieden großen Komponenten (3 col)

  • Dokumentation
Grid of differently sized items
6
4
2
<div class="demo-grid-legend">Grid of differently sized items</div>
<div class="demo-grid mdc-layout-grid">
<div class="mdc-layout-grid__inner">
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-6">6</div>
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-4">4</div>
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-2">2</div>
</div>
</div>

Grid mit verschieden großen Komponenten und Layout-Anpassungen(3 col)

  • Dokumentation
Grid of items with tweaks at different screen sizes
6 (8 tablet)
4 (6 tablet)
2 (4 phone)
<div class="demo-grid-legend">Grid of items with tweaks at different screen sizes</div>
<div class="demo-grid mdc-layout-grid">
<div class="mdc-layout-grid__inner">
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-6 mdc-layout-grid__cell--span-8-tablet">6 (8 tablet)</div>
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-4 mdc-layout-grid__cell--span-6-tablet">4 (6 tablet)</div>
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--span-2 mdc-layout-grid__cell--span-4-phone">2 (4 phone)</div>
</div>
</div>

Grid mit unterschiedlicher Anordnung der Zellen

  • Dokumentation
{align-top}
{align-middle}
{align-bottom}
<div class="demo-grid mdc-layout-grid"style="height: 65vh;">
<div class="mdc-layout-grid__inner" style="height: 60vh;">
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--align-top mdc-layout-grid__cell--span-8-tablet">{align-top}</div>
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--align-middle mdc-layout-grid__cell--span-8-tablet">{align-middle}</div>
<div class="demo-cell mdc-layout-grid__cell mdc-layout-grid__cell--align-bottom mdc-layout-grid__cell--span-8-tablet">{align-bottom}</div>
</div>
</div>