|
| 1 | +# Textarea |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +Adapt UI provides one theme for text area component with three styles and eight interaction states. Use this component to receive information from the user. |
| 7 | + |
| 8 | +#### Simple Usage |
| 9 | + |
| 10 | +```js |
| 11 | +import { TextArea } from "@adaptui/react-native-tailwind" |
| 12 | +export default function App() { |
| 13 | + return ( |
| 14 | + <TextArea placeholder="Type Something...." /> |
| 15 | + ) |
| 16 | +} |
| 17 | +``` |
| 18 | + |
| 19 | +## Table of Contents |
| 20 | + |
| 21 | + - [Themes](#themes) |
| 22 | + - [Variant](#variant) |
| 23 | + - [Size](#size) |
| 24 | + - [Icon](#icon) |
| 25 | + - [Interactions](#interactions) |
| 26 | + - [Suffix](#suffix) |
| 27 | + - [Props](#props) |
| 28 | +## Themes |
| 29 | + |
| 30 | +Adapt UI provides only one `base` theme for TextArea. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +<details> |
| 35 | + |
| 36 | +<summary> |
| 37 | + <b>Usage</b> |
| 38 | +</summary> |
| 39 | + |
| 40 | +### Usage |
| 41 | + |
| 42 | +```js |
| 43 | +import { TextArea, Slot, Icon } from "@adaptui/react-native-tailwind" |
| 44 | +export default function App() { |
| 45 | + return ( |
| 46 | + <TextArea |
| 47 | + placeholder="Type Something..." |
| 48 | + /> |
| 49 | + ) |
| 50 | +} |
| 51 | + |
| 52 | +``` |
| 53 | + |
| 54 | +</details> |
| 55 | + |
| 56 | +## Variant |
| 57 | + |
| 58 | +Adapt UI provides four different input field components styles: `subtle`, `outline`, |
| 59 | + and `underline`. |
| 60 | + |
| 61 | +You can use these various styled input field components based on the necessity |
| 62 | +and style you wish to provide to your design. |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +<details> |
| 67 | + |
| 68 | +<summary> |
| 69 | +<b>Usage</b> |
| 70 | +</summary> |
| 71 | + |
| 72 | +### Usage |
| 73 | + |
| 74 | +```js |
| 75 | +import { TextArea } from "@adaptui/react-native-tailwind" |
| 76 | + |
| 77 | +export default function App() { |
| 78 | + return ( |
| 79 | + <> |
| 80 | + <TextArea variant="subtle" placeholder="Whats happening" /> |
| 81 | + <TextArea placeholder="Tell us about yourself" /> |
| 82 | + <TextArea variant="underline" placeholder="Type your message here" /> |
| 83 | + </> |
| 84 | + ) |
| 85 | +} |
| 86 | + |
| 87 | +``` |
| 88 | + |
| 89 | +</details> |
| 90 | + |
| 91 | +## Size |
| 92 | + |
| 93 | +There are four different sizes for input in Adapt UI: `sm`, `md`, `lg` & `xl` |
| 94 | + |
| 95 | +Based on the hierarchy, you can switch between different sizes. |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | +<details> |
| 102 | + |
| 103 | +<summary> |
| 104 | +<b>Usage</b> |
| 105 | +</summary> |
| 106 | + |
| 107 | +### Usage |
| 108 | + |
| 109 | +```js |
| 110 | +import { TextArea } from "@adaptui/react-native-tailwind" |
| 111 | + |
| 112 | +export default function App() { |
| 113 | + return ( |
| 114 | + <> |
| 115 | + <TextArea size="sm" placeholder="Whats happening" /> |
| 116 | + <TextArea placeholder="Whats in your mind?" /> |
| 117 | + <TextArea size="lg" placeholder="Type your message here" /> |
| 118 | + <TextArea size="xl" placeholder="Tell us about yourself" /> |
| 119 | + </> |
| 120 | + ) |
| 121 | +} |
| 122 | + |
| 123 | +``` |
| 124 | +</details> |
| 125 | + |
| 126 | +### Interactions |
| 127 | + |
| 128 | +We tried to bring the most commonly used interactions for the text area component. Adapt UI provides eight-input interactions: default, hover, active, focus, disabled, loading, error, and filled. These can give a complete cycle of text area interactions. |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | +<details> |
| 133 | + |
| 134 | +<summary> |
| 135 | +<b>Usage</b> |
| 136 | +</summary> |
| 137 | + |
| 138 | +### Usage |
| 139 | + |
| 140 | +```js |
| 141 | +import { TextArea } from "@adaptui/react-native-tailwind" |
| 142 | + |
| 143 | +export default function App() { |
| 144 | + return ( |
| 145 | + <> |
| 146 | + <TextArea placeholder="Type something..." loading={true} /> |
| 147 | + <TextArea placeholder="Type Something" editable={true} /> //disabled |
| 148 | + <TextArea placeholder="Type something..." invalid={true} /> |
| 149 | + </> |
| 150 | + ) |
| 151 | +} |
| 152 | + |
| 153 | +``` |
| 154 | + |
| 155 | +</details> |
| 156 | + |
| 157 | + |
| 158 | +### Suffix |
| 159 | + |
| 160 | +The suffix is a slot at the beginning or suffix position of a component. Here in the Textarea, the suffix slot can be used to bring icons. Suffix itself doesn't have any unique property. |
| 161 | + |
| 162 | +Here in the Textarea, we have an icon in the suffix slot. You can change the icon by passing an component to suffix prop. |
| 163 | +The Icon will get hidden when the `loading` prop is true. |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | +<details> |
| 168 | + |
| 169 | +<summary> |
| 170 | +<b>Usage</b> |
| 171 | +</summary> |
| 172 | + |
| 173 | +### Usage |
| 174 | + |
| 175 | +```js |
| 176 | +import { TextArea } from "@adaptui/react-native-tailwind" |
| 177 | + |
| 178 | +export default function App() { |
| 179 | + return ( |
| 180 | + <> |
| 181 | + <TextArea placeholder="Type something..." |
| 182 | + suffix={<Icon icon={<Slot />} />} |
| 183 | + /> |
| 184 | + </> |
| 185 | + ) |
| 186 | +} |
| 187 | + |
| 188 | +``` |
| 189 | + |
| 190 | +</details> |
| 191 | + |
| 192 | +## Props |
| 193 | + |
| 194 | +> TextArea implements TextInput from React Native accepting all `TextInputProps` |
| 195 | +
|
| 196 | +| Name | Description | Type | Default | |
| 197 | +| ------------- | ------------------------------------------------------------------------------------ | ------------------------------ | -------- | |
| 198 | +| size | Size of TextArea | `sm` `md` `lg` `xl` | `md` | |
| 199 | +| variant | How will the TextArea look? | `outline` `subtle` `underline` | `subtle` | |
| 200 | +| suffix | If added, the TextArea will show an icon on the bottom right of the TextArea's text. | JSX.Element | null | |
| 201 | +| editable | If true, TextArea is disabled | boolean | false | |
| 202 | +| invalid | Set to true, when TextArea Value is invalid | boolean | false | |
| 203 | +| loading | If true, TextArea renders a spinner in suffix slot | boolean | false | |
| 204 | +| \_suffixProps | Touchable props for the suffix element | `PressableProps` | {} | |
0 commit comments