Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div id="root" class="main"><div>


                body {
  font-family: 'Quicksand', sans-serif;

.main {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;

.welcome {
  text-align: center;
  width: 90%;
  margin: auto;

.robot {
   height: 200px;

form {
  margin: auto;
  display: block;
  width: 70%;
input {
  border: none;
  border-bottom: 2px solid pink;
  background: transparent;
  outline: none;
  font-size: 1em;
  width: 100%;

button {
  margin: auto;
  display: block;
  margin-top: 2em;
  padding: 0.8em 2em;
  background: pink;
  font-family: 'Quicksand', sans-serif;
  font-weight: bold;
  color: white;

.advice {
  margin-top: 2em;
  background: pink;
  color: white;
  width: 70%;
  margin: auto;
  display: block;


                class App extends React.Component {
  constructor(props) {
    this.state = {
      query: "",
      advice: false,
      cantHelp: [
        "Canny help ye there lad",
        "I dont know much about that, sorry",
        "Your problems are too niche for even me",
        "Nope, not a clue",
        "Try again, but this time be better",
        "Hmmmm, dont think I know anything about that one, sorry!",
        "I am merely a machine, I cant help with that",
        "Just no"
    this.getAdvice = this.getAdvice.bind(this);

    this.handleChange = this.handleChange.bind(this);

  handleChange(event) {
    this.setState({ query: });

  getAdvice(event) {
        response =>

            ? this.setState({
                    Math.floor(Math.random() *
            : this.setState({
                advice: this.state.cantHelp[
                  Math.floor(Math.random() * this.state.cantHelp.length)
      .catch(err => {

  render() {
    return (
      <div class="wrapper">
          <div class="welcome">
            <img class="robot" src=""/>
              Hello, I'm Something, your friendly advice supplier. Tell me what
              you're worried about and I'll see if I can help.{" "}
            <div class="form">
              <form autoComplete="off">
                  placeholder="What do you need help with?"
              <button onClick={this.getAdvice}> Get advice </button>
          <div class="advice">
            <p>my advice is.. </p>

ReactDOM.render(<App />, document.getElementById("root"));