diff --git a/.changeset/ninety-eggs-cross.md b/.changeset/ninety-eggs-cross.md new file mode 100644 index 0000000..44faa11 --- /dev/null +++ b/.changeset/ninety-eggs-cross.md @@ -0,0 +1,5 @@ +--- +"@openfun/cunningham-react": minor +--- + +add TextArea component diff --git a/packages/react/src/components/Forms/TextArea/index.mdx b/packages/react/src/components/Forms/TextArea/index.mdx new file mode 100644 index 0000000..212ad0a --- /dev/null +++ b/packages/react/src/components/Forms/TextArea/index.mdx @@ -0,0 +1,126 @@ +import { Canvas, Meta, Story, Source, ArgTypes } from '@storybook/blocks'; +import * as Stories from './index.stories'; +import { TextArea } from '.'; + + + +# TextArea + +Cunningham provides a versatile TextArea component that you can use in your forms. + + + + + + + +## States + +You can use the following props to change the state of the TextArea component by using the `state` props. + + + + + + + + + + + + + +## Disabled + +As a regular textarea, you can disable it by using the `disabled` props. + + + + + + +## Texts + +You can define a text that will appear below the input by using the `text` props. + + + + + +You can also independently add a text on the right side by using the `rightText` props. + + + + + +## Width + +By default, the textarea has a default width, like all inputs. But you can force it to take the full width of its container by using the `fullWidth` props. + + + + + +## Chars Counter + +You can display a counter of the number of characters entered in the textarea by using the `charsCounter` props. Please bare +in mind to also define `charCounterMax`. + + + + + +## Controlled / Non Controlled + +Like a native textarea, you can use the TextArea component in a controlled or non controlled way. You can see the example below +using the component in a controlled way. + + + + + +## Ref + +You can use the `ref` props to get a reference to the textarea element. + + + + + +## Props + +You can use all the props of the native html `