diff --git a/README.md b/README.md
index 4f78420..44b679f 100644
--- a/README.md
+++ b/README.md
@@ -202,6 +202,32 @@ let Basic = React.createClass({
console.log(jsxToString(, {
displayName: 'CustomName'
})); //outputs:
+```
+
+ * singleLineProps (boolean)
+
+ Optional. Defaults to false. Prints props on a single line when the component has children.
+
+```js
+import React from 'react';
+import jsxToString from 'jsx-to-string';
+//or var jsxToString = require('jsx-to-string');
+
+let Basic = React.createClass({
+ render() {
+ return (
+
+ );
+ }
+}); //this is your react component
+
+console.log(jsxToString(child, {
+ singleLineProps: true
+}));
+//outputs:
+//
+// child
+//
```
### License
diff --git a/src/index.js b/src/index.js
index 0946176..cb3427a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -77,7 +77,8 @@ function jsxToString (component, options) {
ignoreTags: [],
keyValueOverride: {},
spacing: 0,
- detectFunctions: false
+ detectFunctions: false,
+ singleLineProps: false
};
const opts = {...baseOpts, ...options};
@@ -120,7 +121,7 @@ function jsxToString (component, options) {
value = valueLines.join(`\n${indentation}`);
}
return `${key}=${value}`;
- }).join(`\n${indentation}`);
+ }).join(opts.singleLineProps ? ' ' : `\n${indentation}`);
if (component.key && opts.ignoreProps.indexOf('key') === -1) {
componentData.props += `key='${component.key}'`;