diff --git a/src/components/Textarea/__test__/textarea.spec.js b/src/components/Textarea/__test__/textarea.spec.js
index c3e093d4f..a60f94943 100644
--- a/src/components/Textarea/__test__/textarea.spec.js
+++ b/src/components/Textarea/__test__/textarea.spec.js
@@ -56,4 +56,15 @@ describe('', () => {
inputId: expect.any(String),
});
});
+ it('should have a inside div with id="headerTest"', () => {
+ const component = mount(} />);
+ const div = component.find('div[id="headerTest"]');
+ expect(div.exists()).toBeTruthy();
+ });
+
+ it('should have a inside div with id="footerTest"', () => {
+ const component = mount(} />);
+ const div = component.find('div[id="footerTest"]');
+ expect(div.exists()).toBeTruthy();
+ });
});
diff --git a/src/components/Textarea/index.js b/src/components/Textarea/index.js
index fe6b29b62..7b9523f07 100644
--- a/src/components/Textarea/index.js
+++ b/src/components/Textarea/index.js
@@ -95,6 +95,7 @@ class Textarea extends Component {
id,
hideLabel,
name,
+ header,
footer,
variant,
} = this.props;
@@ -110,12 +111,12 @@ class Textarea extends Component {
id={this.getInlineTextLabelId()}
/>
+ {header}
{footer}
@@ -200,6 +200,8 @@ Textarea.propTypes = {
variant: PropTypes.oneOf(['default', 'shaded']),
/** The id of the outer element. */
id: PropTypes.string,
+ /** It is what will be displayed at the top of the component. */
+ header: PropTypes.node,
/** It is what will be displayed at the bottom of the component. */
footer: PropTypes.node,
};
@@ -228,6 +230,7 @@ Textarea.defaultProps = {
variant: 'default',
id: undefined,
hideLabel: false,
+ header: undefined,
footer: undefined,
};
diff --git a/src/components/Textarea/readme.md b/src/components/Textarea/readme.md
index 1046145f8..2fe3737e1 100644
--- a/src/components/Textarea/readme.md
+++ b/src/components/Textarea/readme.md
@@ -118,6 +118,79 @@ const containerStyles = {
/>;
```
+##### Textarea with header
+
+```js
+import React, { useState } from 'react';
+import { Textarea, Chip } from 'react-rainbow-components';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { faImage } from '@fortawesome/free-solid-svg-icons';
+import styled from 'styled-components';
+
+const StyledHeader = styled.div.attrs(props => {
+ return props.theme.rainbow.palette;
+})
+`
+ font-size: 12px;
+ color: ${props => props.text.header};
+ text-align: center;
+ border-radius: 0.875rem 0.875rem 0 0;
+ margin: 16px 16px 0 16px;
+`;
+
+const containerStyles = {
+ maxWidth: 700,
+};
+
+const chipStyles = {
+ width:'100%'
+}
+
+const Icon = styled.span.attrs(props => {
+ return props.theme.rainbow.palette;
+})`
+ ${props =>
+ `
+ color: ${props.brand.main};
+ `};
+`;
+
+function TextareaExample(props) {
+ const [count, setCount] = useState(0);
+ const {maxLength} = props;
+
+ return (
+