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

@asphalt-react/actionlist

v2.0.0-rc.0

Published

Actionlist

Downloads

284

Readme

Actionlist

npm

A component to display a list of actions. It consists of 2 components

  • Actionlist
  • Action

Actionlist provides accessibility features to operate on Actions. It also represents a bunch of provided Actions as a list. It supports 3 sizes: small (s), medium (m), large (l) where small is the default size.

An Action can function as any HTML or React element. Each action has an option to include an icon before the caption.

💡 Checkout @asphalt-react/iconpack for SVG wrapped React components.

Accessibility

  • Navigate among Actions using and arrow keys.
  • home and end focuses the first and last Actions respectively.
  • Select an action with the enter when in focus.
  • Select an actionable action(behave as button) with the enter or space when in focus.
  • Action and Actionlist takes care of necessary aria-* attributes.
  • Actionlist has role="menu" and actions have role="menuitem" attributes.
  • All the actions are organized as list items <li> in an unordered list <ul>.
  • You can also add other aria-attributes like aria-labelledby, aria-label to assist screen readers.

Usage

import { Actionlist, Action } from "@asphalt-react/actionlist"
import { Link } from '@reach/router'

function App () {

    return (
        <Actionlist>
            <Action as="Link" asProps={{ to: "/document/edit" }}>
                Edit
            </Action>
            <Action actionable asProps={{ onClick: (event) => {} }}>
                Clone
            </Action>
            <Action>Share</Action>
            <Action>Delete</Action>
        </Actionlist>
    )
}

export default App;

Props

children

List of actions to display inside Actionlist.

| type | required | default | | ---- | -------- | ------- | | node | true | N/A |

size

Size of the Actionlist. Accepts s, m, l for small, medium & large.

| type | required | default | | ---- | -------- | ------- | | enum | false | "s" |

Action

An action item in an Actionlist. It renders an <a> tag by default.

Props

children

Add caption for each Action.

| type | required | default | | ---- | -------- | ------- | | node | false | N/A |

qualifier

Renders an icon or text before the Action's caption. Accepts SVG.

Checkout @asphalt-react/iconpack for SVG icons

| type | required | default | | ----- | -------- | ------- | | union | false | N/A |

qualifierEnd

Appends qualifier to the caption.

| type | required | default | | ---- | -------- | ------- | | bool | false | false |

danger

Applies danger styles to Action.

| type | required | default | | ---- | -------- | ------- | | bool | false | false |

actionable

Action behaves like a button.

| type | required | default | | ---- | -------- | ------- | | bool | false | false |

as

Use it to replace the default "anchor" tag with your router element. Accepts HTML element or a React component type.

| type | required | default | | ----------- | -------- | ------- | | elementType | false | N/A |

asProps

Accepts props & attributes for the link element. You can pass attributes like onKeyPress, href.

| type | required | default | | ------ | -------- | ------- | | object | false | {} |

separator

Renders a separator before the Action, except for first one.

| type | required | default | | ---- | -------- | ------- | | bool | false | false |