Answers for "react style component"

4

styled componets npm

npm i styled-components
Posted by: Guest on August-14-2020
17

styled-components

npm install --save styled-components

# yarn 
yarn add styled-components
Posted by: Guest on July-24-2020
37

inline style jsx

//Multiple inline styles
<div style={{padding:'0px 10px', position: 'fixed'}}>Content</div>
Posted by: Guest on September-09-2020
28

inline style react

// You are actuallty better off using style props
// But you can do it, you have to double brace
// and camel-case the css properties
render() {
	return (
    	<div style={{paddingTop: '2em'}}>
      		<p>Eh up, me duck!</p>
      	</div>
    )
}
Posted by: Guest on March-14-2020
5

styled components

const Button = styled.button`
  background: transparent;
  border-radius: 3px;
  border: 2px solid palevioletred;
  color: palevioletred;
  margin: 0.5em 1em;
  padding: 0.25em 1em;

  ${props => props.primary && css`
    background: palevioletred;
    color: white;
  `}
`;

const Container = styled.div`
  text-align: center;
`

render(
  <Container>
    <Button>Normal Button</Button>
    <Button primary>Primary Button</Button>
  </Container>
);const Button = styled.button`  background: transparent;  border-radius: 3px;  border: 2px solid palevioletred;  color: palevioletred;  margin: 0.5em 1em;  padding: 0.25em 1em;  ${props => props.primary && css`    background: palevioletred;    color: white;  `}`;const Container = styled.div`  text-align: center;`render(  <Container>    <Button>Normal Button</Button>    <Button primary>Primary Button</Button>  </Container>);
/**
 * Reset the text fill color so that placeholder is visible
 */
.npm__react-simple-code-editor__textarea:empty {
  -webkit-text-fill-color: inherit !important;
}

/**
 * Hack to apply on some CSS on IE10 and IE11
 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /**
    * IE doesn't support '-webkit-text-fill-color'
    * So we use 'color: transparent' to make the text transparent on IE
    * Unlike other browsers, it doesn't affect caret color in IE
    */
  .npm__react-simple-code-editor__textarea {
    color: transparent !important;
  }

  .npm__react-simple-code-editor__textarea::selection {
    background-color: #accef7 !important;
    color: transparent !important;
  }
}
Normal ButtonPrimary Button
Posted by: Guest on August-07-2020
0

inline styling in react

style={ someCondition ? { textAlign:'center', paddingTop: '50%'} : {}}
Posted by: Guest on May-28-2021

Browse Popular Code Answers by Language