Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
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.5
Version published
Weekly downloads
46
-36.99%
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

export default Button;

Use

import React, { useState } from 'react';
import Button, { ButtonClassProvider } from '../Button';

const Page=()=>{
    const [buttonThemeClass, setButtonThemeClass] = useState('theme_class1');
    const onThemeChange = e => {
        setButtonThemeClass(e.currentTarget.value);
    };
    return (
        <ButtonClassProvider value={buttonThemeClass}>
            <div>
                <select onChange={onThemeChange}>
                    <option value="theme_class1">theme1</option>
                    <option value="theme_class2">theme2</option>
                </select>
                <Button className="nu_btn">Button</Button>
                <Button className="nu_btn" href="/nu-button">Button</Button>
            </div>
        </ButtonClassProvider>
    );
};

export default Page;

Api

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

=>

<button class="nu_btn _fill" type="button" title="hello">hello</button>
<button class="nu_btn _fill" type="button"><strong>hello</strong></button>
<button class="nu_btn _fill" type="button" disabled title="hello">hello</button>
<button class="nu_btn _primary _fill" type="button" title="hello">hello</button>
<button class="nu_btn _fill _primary" type="button" title="hello">hello</button>
<a class="nu_btn _fill _primary" href="." title="hello">hello</a>

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 15 May 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