1.17.0 ā€¢ Published 3 months ago

@asphalt-react/actionlist v1.17.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
3 months ago

Actionlist

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 bunch of provided Actions as a list.

An Action can function as any HTML or React element, it also supports qualifier to add icons before the caption for an action. A qualifier accepts SVG or SVG wrapped React component.

šŸ’” 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.
  • Action and Actionlist takes care of necessary aria-* attributes.
  • You can also add other aria-attributes like aria-labelledby, aria-label.

Usage

import Actionlist, { Action } from "@asphalt-react/actionlist"

function App () {

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

export default App;

Props

children

List of actions to display inside Actionlist

typerequireddefault
nodetrueN/A

Action

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

Props

children

Add content for each Action

typerequireddefault
nodefalseN/A

qualifier

Renders an icon before the Action's content. Accepts SVG or SVG wrapped React component.

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

typerequireddefault
elementfalseN/A

danger

Applies danger styles to Action

typerequireddefault
boolfalsefalse

actionable

Action behaves like a button

typerequireddefault
boolfalsefalse

as

HTML element/React component to be rendered

typerequireddefault
elementTypefalseN/A

tagProps

Props for the Action element being rendered Attributes like onKeyPress, href can be passed

typerequireddefault
objectfalse{}

separator

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

typerequireddefault
boolfalsefalse