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

react-tailwind-dropdown

v1.0.0

Published

React Tailwind Custom Components

Downloads

1

Readme

React Tailwind Components

React Tailwind Components is a custom set of React components designed to seamlessly integrate with Tailwind CSS in your web applications. These components offer flexibility and extensive customization options to enhance your web development experience. Below, you'll find instructions on how to install and use these components in your projects.

Installation To get started with React Tailwind Components, you can easily install the package using npm or yarn:

npm install react-tailwind-components

or

yarn add react-tailwind-components Usage Once the package is installed, you can import and utilize the components in your React applications. Below is an example demonstrating how to use the Dropdown component:

import Dropdown from 'react-tailwind-components';

// ...

<Dropdown className='relative'>
  <Dropdown.Trigger
    type="a"
  >
    Dropdown &#x25be;
  </Dropdown.Trigger>

  <Dropdown.Content as="ul">
    <li>
      <a className="block px-4 py-1.5 text-base font-medium transition-all duration-200 ease-linear bg-white text-slate-600 dropdown-item hover:bg-slate-100 hover-text-slate-500 focus-bg-slate-100 focus-text-slate-500 dark-text-zink-50 dark-bg-zink-400 dark-hover-bg-zink-300" href="#!">Action</a>
    </li>
    <li>
      <a className="block px-4 py-1.5 text-base font-medium transition-all duration-200 ease-linear bg-white text-slate-600 dropdown-item hover-bg-slate-100 hover-text-slate-500 focus-bg-slate-100 focus-text-slate-500 dark-text-zink-50 dark-bg-zink-400 dark-hover-bg-zink-300" href "#!">Another action</a>
    </li>
    <!-- Add more items here -->
  </Dropdown.Content>
</Dropdown>

// Additional examples and components can be integrated here You have the flexibility to customize the styles and behavior of these components by adjusting class names and properties.

Available Props Dropdown Component The Dropdown component serves as the container for the dropdown elements and manages its state. It is responsible for detecting clicks outside the dropdown to close it.

open and setOpen: State variables that track whether the dropdown is open or closed. toggleOpen: A function to toggle the dropdown's open/close state. dropdownRef: A reference to the dropdown element used for detecting clicks outside the dropdown. Trigger Component The Trigger component is used to define the clickable element that triggers the dropdown to open or close. It can be either a button or a link.

type: Specifies the type of trigger element, such as "a" for an anchor link or a button. className: CSS classes for styling the trigger element. id: A unique identifier for the trigger element. href: If it's a link, this specifies the destination route or URL. When clicked, it calls the toggleOpen function from the DropdownContext to open or close the dropdown. Content Component The Content component represents the actual content that appears in the dropdown when it is open. It manages the content's appearance and transition animations.

as: Specifies the HTML element type to be used for the content (default is a div). align: Controls the alignment of the content (left or right). className: CSS classes for styling the content. width: Sets the width of the content. contentClasses: CSS classes specific to the content. children: The content that appears inside the dropdown.

The Content component uses the Transition component from @headlessui/react to apply transition animations when the dropdown opens and closes. It's nested within the DropdownContext, and clicking on the content will close the dropdown. License The React Tailwind Components package is open-source and distributed under the MIT License. You are encouraged to use, modify, and integrate it into your projects.