2.3.12 • Published 5 years ago

nuke-button v2.3.12

Weekly downloads
187
License
Apache-2.0
Repository
gitlab
Last release
5 years ago

Button

  • category: UI
  • chinese: 按钮
  • type: UI Component

Nuke UI

nuke-button@ALINPM nuke-button@ALINPM

Design

Nuke predefined several styles of Buttons, each serving its own semantic purpose.

API

Button

PropsDescriptionTypeDefault
typetype of button,can be normal primary secondarystringnormal
sizesize of button, can be small medium largestringmedium
disableddisable statusbooleanfalse
onPresspress eventfunctionnull
onLongpresslong press event, only works in Weex Nativefunctionnull
iconicon urlstringnull
blockexpands the button to 100% of available spacebooleanfalse
fixedFontkeep text size fixed in different screen resolutionbooleanfalse

Please note:the onLongpress with small p only takes effect in Native App.

Button.Group

ConfigurationDescriptionTypeDefault
blockrepresent as a block, or notbooleanfalse

Demos

Sweep the qr code to preview( use apps like Taobao, Qianniu, Tmall... )

How To Use

  • Install
// Switch to your rax project
tnpm i nuke-button --save
// following that demo, maybe you also need this...
// tnpm i nuke-view nuke-page --save
  • Example
/** @jsx createElement */
import {createElement, Component,render } from 'rax';
import View from 'nuke-view';
import Button from 'nuke-button';
import Page from 'nuke-page';

let App = class NukeDemoIndex extends Component {
    constructor() {
        super();
    }
    press(){
        console.log('111')
    }
    render() {
        return (
            <Page title="Button">
                <Page.Intro main="type:primary" sub="主操作"></Page.Intro>
                <Button.Group style={styles.btnWithMargin} >
                    <Button onPress={this.press} type="primary">primary</Button>
                    <Button disabled type="primary">disabled</Button>
                </Button.Group>
                <Page.Intro main="type:primary" sub="自定义颜色"></Page.Intro>
                <Button.Group style={styles.btnWithMargin} >
                    <Button onPress={this.press} type="primary" style={{borderWidth:'1rem',borderStyle:'solid',borderColor:'#ff6600',backgroundColor:'#ff6600',color:'#ffffff'}}>primary</Button>
                    <Button onPress={this.press} type="primary" style={{borderWidth:'1rem',borderStyle:'solid',borderColor:'#B91630',backgroundColor:'#B91630',color:'#cccccc','borderColor:active':'#770719','backgroundColor:active':'#770719'}}>primary</Button>
                </Button.Group>
                <Page.Intro main="type:secondary" sub="次要操作"></Page.Intro>
                <Button.Group style={styles.btnWithMargin}>
                    <Button type="secondary">secondary</Button>
                    <Button disabled type="secondary">disabled</Button>
                </Button.Group>
                <Page.Intro main="type:normal" sub="普通操作"></Page.Intro>
                <Button.Group style={styles.btnWithMargin}>
                    <Button type="normal">normal</Button>
                    <Button disabled type="normal">disabled</Button>
                </Button.Group>
                <Page.Intro main="shape:warning" sub="警告类操作"></Page.Intro>
                <Button.Group style={styles.btnWithMargin}>
                    <Button type="primary" shape="warning">primary</Button>
                    <Button type="normal" shape="warning">normal</Button>
                </Button.Group>
                <Page.Intro main="block:true" sub="独占一行"></Page.Intro>
                <Button style={styles.btnWithMargin} type="primary" block>primary</Button>
                <Page.Intro main="rect:true" sub="直角"></Page.Intro>
                <Button.Group style={styles.btnWithMargin}>
                    <Button style={styles.btn} rect type="normal">Normal</Button>
                    <Button style={styles.btn} rect type="primary">Primary</Button>
                    <Button style={styles.btn} rect type="secondary">Secondary</Button>
                </Button.Group>

                <Page.Intro main="size" sub="尺寸"></Page.Intro>
                <Button.Group style={styles.btnWithMargin}>
                    <Button style={styles.btn} size="large" type="primary">large</Button>
                    <Button style={styles.btn} size="medium" type="primary">medium</Button>
                    <Button style={styles.btn} size="small" type="primary">small</Button>
                </Button.Group>
                <Page.Intro main="ghost:dark" sub="幽灵模式 深色"></Page.Intro>
                <Button.Group style={[styles.btnLine,{paddingTop:'20rem',paddingBottom:'20rem',backgroundColor:'#4f74b3'}]}>
                    <Button type="dark" shape="ghost">dark</Button>
                    <Button type="dark" shape="ghost" disabled>dark disabled</Button>
                </Button.Group>
                <Page.Intro main="ghost:light" sub="幽灵模式 浅色"></Page.Intro>
                <Button.Group style={[styles.btnLine,{paddingTop:'20rem',paddingBottom:'20rem',backgroundColor:'#e3eaf7'}]}>
                    <Button type="light" shape="ghost">light</Button>
                    <Button type="light" shape="ghost" disabled>light disabled</Button>
                </Button.Group>

                <Page.Intro main="Button.Group rect" sub="Group用法"></Page.Intro>
                <Button.Group style={styles.btnWithMargin} rect>
                    <Button type="normal">Normal</Button>
                    <Button type="third">Third</Button>
                    <Button type="primary">Primary</Button>
                </Button.Group>
            </Page>

        );
    }
}
const styles={
    btnWithMargin:{
        marginTop:'30rem', 
        marginBottom:'50rem', 
        marginLeft:'42rem', 
        marginRight:'42rem' 
    },
    btnLine:{
        marginTop:'30rem', 
        marginBottom:'50rem', 
        paddingLeft:'42rem', 
        paddingRight:'42rem'
    }
}
render(<App/>);
2.3.12

5 years ago

2.3.11

5 years ago

2.3.10

5 years ago

2.3.8

5 years ago

2.3.7

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.4

5 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.0

5 years ago

2.2.29

6 years ago

2.2.28

6 years ago

2.2.26

6 years ago

2.2.24

6 years ago

2.2.23

6 years ago

2.2.21

6 years ago

2.2.19

6 years ago

2.2.18

6 years ago

2.2.17

6 years ago

2.2.16

6 years ago

2.2.14

6 years ago

2.2.13

6 years ago

2.2.11

6 years ago

2.2.10

6 years ago

2.2.8

6 years ago

2.2.7

6 years ago

2.2.6

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.1.10

6 years ago

2.1.6

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.1-4.3

6 years ago

2.1.1-3

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

0.3.19

7 years ago

0.3.18

7 years ago

1.0.0

7 years ago

0.3.17

7 years ago

0.3.16

7 years ago

0.3.15

7 years ago

0.3.14

7 years ago

0.3.13

7 years ago

0.3.12

7 years ago

0.3.11

7 years ago

0.3.10

7 years ago

0.3.9

7 years ago

0.3.8

7 years ago

0.3.7

7 years ago

0.3.6

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.32

7 years ago

0.0.31

7 years ago

0.0.30

7 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago