npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ddm-dropdown

v1.0.1

Published

Dropdown component used in Deseret Digital projects.

Downloads

15

Readme

DDM Dropdown

Dropdown component for DDM projects.

Example

Online Demo: http://deseretdigital-ui.github.io/ddm-dropdown

Before viewing the example code on your local machine, you'll need to run the following commands after cloning:

$ npm install
$ bower install
$ gulp build
$ open ./example/index.html

Usage

Simple

React.render(
  <Dropdown title="Click on me">
    <p>Here's the stuff you'll see when you click on me.</p>
  </Dropdown>,
  document.getElementById('idOfTargetElement')
);

Advanced

React.render(
  <Dropdown>
    <DropdownToggle>
      <button>
        I needed HTML in my toggle
        <img src="open.png" alt="&raquo;" />
      </button>
    </DropdownToggle>
    <DropdownBody>
      <p>Here's the stuff you'll see when you click on me.</p>
    </DropdownBody>
  </Dropdown>,
  document.getElementById('idOfTargetElement')
);

With Links Object

React.render(
  <Dropdown title="Menu" links={arrayOfLinks} />,
  document.getElementById('idOfTargetElement')
);

Props

Dropdown

  • title - String
  • className - String
  • url - String
  • arrow - Bool
  • hover - Bool
  • hoverDelay - Number
  • onOpen - Func
  • onClose - Func
  • links - Array

title

Default value is an empty string.

Title is required if you are not manually specifying the DropdownToggle component. The title becomes the clickable that opens up the dropdown.

className

Default value is an empty string.

A space delimited string of additional classes to add onto the dropdown wrapper.

url

Default value is null.

If a string is passed in, this will become the href of DropdownToggle. Clicking on the toggle after the dropdown is opened will take the user to the href instead of closing the dropdown.

arrow

Default value is true.

This controls the display of the arrow displayed in the toggle when the dropdown is open. Setting it to false will remove the arrow.

hover

Default value is true.

This controls whether the dropdown is opened simply by hovering over the toggle with the mouse cursor. Leaving the dropdown wrapper with the mouse will also cause the dropdown to close. Set to false to disable hover opens.

hoverDelay

Default value is 300.

The number of milliseconds to wait before the dropdown will open or close when the toggle is hovered over or when the mouse leaves the dropdown.

onOpen

Default value is null.

Pass a callback you would like called when the dropdown opens.

onClose

Default value is null.

Pass a callback you would like called when the dropdown closes.

links

Default value is an empty array.

An array of link objects that can be used to automatically populate the body instead of having to manually type out an unordered list of anchor tags.

Link objects have the following format:

var linkObject = {
  'link': 'KSL',
  'href': 'http://ksl.com',
  'title': 'Visit the world\'s best news site'
};

DropdownToggle

  • href - String
  • arrow - Bool

href

This prop works the same as in Dropdown but is specified on the DropdownToggle instead of you are manually defining the DropdownToggle.

arrow

This prop works the same as in Dropdown but is specified on the DropdownToggle instead of you are manually defining the DropdownToggle.

DropdownBody

  • links - Array

links

This prop works the same as in Dropdown but is specified on the DropdownBody instead of you are manually defining the DropdownBody.