-
Notifications
You must be signed in to change notification settings - Fork 0
Button
Radi Cho edited this page Mar 26, 2019
·
4 revisions
This component, by default, looks like this:

which can be achieved with the following code:
import React from 'react'
import ReactDOM from 'react-dom'
import {RSGButton} from 'rsg-components'
var app = document.querySelector('#app');
ReactDOM.render(
<RSGButton>BUTTON</RSGButton>, app
)
In version
3.0.0-beta.1and laterRSGis removed from the components so you have to use onlyButtoninstead ofRSGButton
NOTE: The RSGButton supports all standard props React buttons accept.
| Props | Type | Description |
|---|---|---|
| standard props | standard | all standard React props for a button: http://goo.gl/SSrsHn |
| background | string like this: "red" | Set the background like the html style tag: style="background: red" |
| color | string like this: "blue" | Set the color like the html style tag: style="color: blue" |
| fontSize | string like this: "10px" | Set the fontSize like the html style tag: style="font-size: 10px" |
| fontStyle | string like this: "italic" | Set the fontStyle like the style tag: style="font-style: italic" |
| opacity | string like this: "0.5" | Set the opacity % like the html style tag: style="opacity: 0.5" |
The special prop "sizes" sets the size of the button. It accepts one of the following:
| prop value | size styles |
|---|---|
| s | padding: 1px 3px; font-size: 12px |
| l | padding: 5px 7px; font-size: 18px |
| xl | padding: 9px 11px; font-size: 20px |
| xxl | padding: 12px 14px; font-size: 25px |
| default | padding: 5px 4px; font-size: 16px |
The "sizes" prop:
import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from 'rsg-components';
class MainComponent extends React.Component {
render(){
return(
<div>
<Button sizes={`xxl`}>BUTTON</Button>
</div>
)
}
}
var app = document.getElementById('app');
ReactDOM.render(<MainComponent />, app);
RESULT:

The background prop:
import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from 'rsg-components';
export class MainComponent extends React.Component {
render(){
return(
<div>
<Button background={`red`}>BUTTON</Button>
</div>
)
}
}
var app = document.getElementById('app');
ReactDOM.render(<MainComponent />, app);
RESULT:

If you want to use rsg-components (and any other thing related to React, for that matter) at it's best, I recommend you read more React docs:
And understand it's architecture and history better.
- https://en.wikipedia.org/wiki/React_(JavaScript_library)
- https://github.com/acdlite/react-fiber-architecture (For understanding React Fiber's (aka React 16+) internals)
npm install rsg-components --save
or
yarn add rsg-components