• Stars
    star
    144
  • Rank 254,329 (Top 6 %)
  • Language Vue
  • License
    MIT License
  • Created about 1 year ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A macOS-like dock component made with WebComponents

dockbar

A macOS like dockbar component made with Web Components
that can be used in any framework.


Install

  • NPM

    npm install dockbar --save
  • CDN

    ESM(Example)

    <head>
      <script type="module" src="https://unpkg.com/dockbar@latest/dockbar.js"></script>
    </head>

    IIFE(Example)

    <head>
      <script src="https://unpkg.com/dockbar@latest/dockbar.iife.js"></script>
    </head>

    Go to Codepen for a quick try.

Usage

Basic usage

<body>
  <dock-wrapper>
    <dock-item>1</dock-item>
    <dock-item>2</dock-item>
    <dock-item>3</dock-item>
    <dock-item>4</dock-item>
  </dock-wrapper>
</body>

It is recommended to use a custom element inside dock-item, so that you can customize the content of dock-item.

<dock-wrapper>
  <dock-item>
    <div class="my-element"></div>
  </dock-item>
</dock-wrapper>

You may need to look at docs if you are using a framework like Vue.js or React.

Custom Style

Apply class to dock-wrapper and dock-item and customize your own style.

For more, see Configuration.

Problems

There are some problems yet to be solved:

  • SSR compatibility It does not work will in SSR framework like Nuxt.js. For now you have to render it inside ClientOnly, and import component asynchronously.
  • Style asynchronous loading causes a flash on init If you are not using by iife, it may cause a flash on init, because the style is loaded asynchronously. For now you could resolve this by applying a style:
    <head>
      #dock {
        visibility: hidden;
      }
      #dock:defined {
        visibility: visible;
      }
    </head>
    <body>
      <dock-wrapper id="dock">
    
      </dock-wrapper>
    </body>

Configuration

Property Type Default Description
size number 40 The size of dock-item in px, see Sizes
padding number 8 The padding of dock-wrapper in px, see Sizes
gap number 8 The gap between dock-item in px, see Sizes
maxScale number 2 The max scale of dock-item, see Sizes
maxRange number 200 The max range of dock-item that will scale when mouseover in px, see Sizes
disabled boolean false Disable the scale effect
direction horizontal | vertical horizontal The direction of dock-items
position top | bottom | left | right bottom The position of dock-wrapper, will affect the scale origin

Sizes

customize sizes

More Repositories

1

ipad-cursor

● Mouse effect of iPad in browser that can be used in any framework
TypeScript
402
star
2

ssr-contributions-img

Server side rendering of Github contribution wall API
TypeScript
199
star
3

svg-drawing

A canvas for easy sketching and replay, exportable in SVG format.
Vue
176
star
4

quantitative-investment-learning

使用Python进行量化投资的学习报告
86
star
5

quant-on-volume

基于成交量的股票数据分析系统
JavaScript
49
star
6

me

Personal profile
Vue
16
star
7

awesome-effects

online effects
SCSS
13
star
8

css-paper-curve

TypeScript
11
star
9

MACD-Analyze

Python 对 MACD 的计算以及相关投资策略的分析
Python
9
star
10

calliplat-wx-miniPrpgram

社区类微信小程序全栈
PHP
8
star
11

stock-price-num-score

根据《胡立阳股票投资100招》给股票打分的盈利率
Python
5
star
12

ui-collection

Collection of UI/UX,Practice With CSS(3) / Less, Basing On Vue.js
Vue
5
star
13

clock-clock-white

Awesome clock
Vue
5
star
14

noise-maker

Simple svg noise generator
Vue
5
star
15

electron-hero-window-demo

window expansion animation hack with electron
TypeScript
5
star
16

line-of-ma

'老太太炒股法', 一根均线打天下, 利用Python根据均线分析这一策略的可行性
Python
4
star
17

stock-cci

计算股票的cci, 判断cci指标的可行性
Python
2
star
18

CatsJuice

2
star
19

netease-stock-day-line

Python爬虫抓取网易财经日线
Python
2
star
20

eastmoney-yaowen-keyword

Python抓取东方财富要闻的热点词
Python
2
star
21

stock-volume-analyze

Python 量化投资之对分时数据中换手量的分析
Python
1
star
22

python-quantitative-investment

基于python的量化投资学习
Python
1
star
23

low-switch-hand-rate

Python对低换手率股票在脱离低换手率后股价的分析
Python
1
star
24

utils

TypeScript
1
star
25

optional-clip

A web-component to implement css overflow:hidden in specific side
TypeScript
1
star