🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@_nu/react-button

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@_nu/react-button

No UI dependency Button of react

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
39
-15.22%
Maintainers
2
Weekly downloads
 
Created
Source

Button

npm package npm downloads github

No UI dependency button of react.

English | 简体中文

Install

yarn add @_nu/react-button @_nu/css-button

Custom

/* @components/Button/index.js */
import Button from "@_nu/react-button";
import "@_nu/css-button";     // core style
import "@_nu/css-button/css/skins/bootstrap.css"; // skin of bootstrap
import './style.css'; // custome style

Button.defaultProps.classNameBase = "_fill";  // base className of button

export default Button;

Use

import Button from "./components/Button";

const Page=()=>{
    return (
     <div>
        <Button>Button</Button>
        <Button href="/nu-button">Button</Button>
     </div>
    );
};

export default Page;

Struct

<Component>
    <ComponentSub>{children}</ComponentSub>
</Component>

Api

ProptypeDefaultFunction
childrenstring | Array' 'children
classNamestring | Array' 'className
classNameDefaultstring | Array'_fill'default className
hrefstring' 'href for a
disabledbooleanfalsedisabled status of button
Componentstring | func | object'button'wrapper
ComponentSubstring | func | object'span'container
<Button>hello</Button>
<Button><strong>hello</strong></Button>
<Button disabled>hello</Button>
<Button className="_primary">hello</Button>
<Button SubComponent="strong">hello</Button>
<Button href="." title="hello">hello</Button>
<button class="nu_btn _fill" type="button"><span>hello</span></button>
<button class="nu_btn _fill" type="button"><strong>hello</strong></button>
<button class="nu_btn _fill" type="button" disabled><span>hello</span></button>
<button class="nu_btn _primary _fill" type="button"><span>hello</span></button>
<button class="nu_btn _fill" type="button"><strong>hello</strong></button>
<a class="nu_btn _fill" href="." title="hello"><span>hello</span></a>

classNames

<Button className="_primary _fill _ghost _primary">hello</Button>
<Button className={['_primary','_fill','_ghost','_primary','','',null]}>hello</Button>
<button class="nu_btn _primary _ghost" type="button"><span>hello</span></button>
  • duplicate class will remove;
  • _fill,_ghost,_link show on className. only the last one will be render;
  • empty will be ignore;
import { Link } from "@reach/router";
import Button from "@_nu/react-button";
import "@_nu/css-button";
import "./style.css";

// Custom
Button.defaultProps.component = Link;

export default Button;

Custom default className?

Button.defaultProps.classNameDefault = "_fill _capsule";

// or

Button.defaultProps.classNameDefault = ["_fill", "_capsule"];

Custom style?

Go to @_nu/css-button

test

// How to start
npm test
// generate coverage report
npm run test:coverage

Keywords

react-component

FAQs

Package last updated on 05 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts