Skip to content

FactorSef/react-css-editor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React CSS Editor

React textarea component for editing style objects as CSS strings

Demo: http://jxnblk.com/react-css-editor

npm i react-css-editor
import React from 'react'
import CSSEditor from 'react-css-editor'

class App extends React.Component {
  state = {
    style: {
      color: 'tomato'
      padding: 16
    }
  }

  update = fn => {
    this.setState(fn)
  }

  render () {
    const { style } = this.state

    return (
      <div>
        <CSSEditor
          value={style}
          onChange={val => {
            this.update(state => ({ style: val }))
          })
        />
        <button style={style} children='Hello' />
      </div>
    )
  }
}

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%