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

@tabula/ui-button

v9.1.1

Published

Button components which are used to initialize an action

Downloads

592

Readme

@tabula/ui-button

Button components which are used to initialize an action.

Installation

Use the package manager pnpm to install @tabula/ui-button.

pnpm add @tabula/ui-button

You can use npm or yarn too.

Usage

We provide five different button sizes with own visual styles:

  • UiButton20
  • UiButton24
  • UiButton32
  • UiButton40
  • UiButton48

Import required component and render it with one of supported variants:

import { FC, MouseEventHandler, PropsWithChildren } from 'react';

import { UiButton24 } from '@tabula/ui-button';

type Props = PropsWithChildren<{
  onClick: MouseEventHandler<HTMLButtonElement>;
}>;

const Action: FC<Props> = ({ children, onClick }) => (
  <UiButton24 onClick={onClick} variant='primary'>{children}</UiButton24>
)

Types

The component supports four types: button, a, div and link. By default, the button type is used.

Button

By default, the component renders generic button:

<UiButton24 variant="primary">Default</UiButton24>

You can provide as="button" explicitly:

<UiButton24 as="button" variant="primary">Button</UiButton24>

Anchor

You can render a element with providing as="button":

  <UiButton24 as="a" href="#" target="_blank" variant="primary">Anchor</UiButton24>

Div

In rare cases, you can render div element with providing as="div":

<UiButton24 as="div" variant="primary">Div</UiButton24>

Link

You can use as="link" and provide component property to use react-router's Link component:

import { Link } from 'react-router-dom';

<UiButton24 as="link" component={Link} target="_blank" to="#" variant="contract">Link</UiButton24>

It can be useful, when you want to have div element with button appearance. For example, to render it inside another button element.

Variants

Each button component has its own appearance variants list, which you can use:

  • UiButton20: contract;
  • UiButton24: primary, secondary, cancel, cancelFilled, edit, test and ai;
  • UiButton32: primaryDesign, secondaryDesign, primaryList, secondaryList, dangerousList and shadowList;
  • UiButton40: primary, secondary, secondaryBlue and secondaryFilled;
  • UiButton48: primary and secondary;

Options

The component supports a few options.

isDisabled

This property allows to disable button:

<UiButton24 isDisabled variant="primary">Button</UiButton24>

isFrozen

This property allows to disable button, but keep enabled look and feel:

<UiButton24 isFrozen variant="primary">Button</UiButton24>

isDisabled and isFrozen

The isDisabled styles has priority over isFrozen when they're used together.

<UiButton24 isDisabled isFrozen variant="primary">Button</UiButton24>

icon

You can provide an icon component:

import { UiDateIcon } from '@tabula/ui-data-type-icon';

<UiButton24 icon={UiDateIcon} variant="primary">Open calendar</UiButton24>

We recommend use icons with size of 16x16.

An icon component should support className property.

Attributes

All component types supports relevant HTML attributes, excluding aria-disabled and disabled. These attributes are controlled by the component itself.

Also href attribute is restricted link type.

For example, you can provide data-* attribute for analytics purposes:

  <UiButton24 data-track-id="button" variant="primary">Button</UiButton24>

License

This project is ISC licensed.