Giter Site home page Giter Site logo

mdheller / react-osx-dock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lukehorvat/react-osx-dock

0.0 1.0 0.0 13.73 MB

React component that is magnifiable like the Mac OS X dock.

Home Page: https://lukehorvat.github.io/react-osx-dock

License: MIT License

JavaScript 78.24% HTML 21.76%

react-osx-dock's Introduction

react-osx-dock NPM version

React component that is magnifiable like the Mac OS X dock.

Works in any Web browser that supports CSS grid and flexbox layout.

View a demo here.

Installation

Install the package with NPM:

$ npm install react-osx-dock

Usage

Example:

import Dock from "react-osx-dock";

<Dock width={800} magnification={2} magnifyDirection="up">
  {["a", "b", "c", "d", "e"].map((item, index) => (
    <Dock.Item key={index} onClick={() => console.log(item)}>
      <img src={`${item}.png`} />
    </Dock.Item>
  ))}
</Dock>

API

Dock

React component that accepts Dock.Items as children, and the following props:

Name Description Type Required
width The width of the dock in pixels. number yes
magnification The level of dock magnification produced on mouse-over. number yes
magnifyDirection The vertical direction that dock items grow when magnified. string enum

("up", "down", "center")
yes
className The dock's CSS class. string no

default: undefined
backgroundClassName The dock background's CSS class. string no

default: undefined
debug Whether to render dock sub-component bounding boxes or not. Useful for debugging! boolean no

default: false

Dock.Item

React component that accepts any HTML/React elements as children, and the following props:

Name Description Type Required
className The dock item's CSS class. string no

default: undefined
onClick The dock item's mouse click event handler. function no

default: undefined

Contributing

Pull requests are most welcome. Clone this repository and run npm test to test/debug your code changes.

Credits

The demo website uses a couple of free icon packs from FlatIcon:

Thanks!

react-osx-dock's People

Contributors

lukehorvat avatar nattatorn-dev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.